grim/convey
Clone
Summary
Browse
Changes
Graph
Add a .reviewboardrc file
2022-03-26, Gary Kramlich
8fea0c778f8e
Add a .reviewboardrc file
package
docker
import
(
"testing"
"github.com/stretchr/testify/assert"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/yaml"
)
func
TestTagSingleDestination
(
t
*
testing
.
T
)
{
tag
:=
Tag
{
Source
:
"foo"
,
Destination
:
"bar"
,
}
assert
.
NoError
(
t
,
tag
.
Valid
())
assert
.
Equal
(
t
,
tag
.
Destinations
,
yaml
.
StringOrSlice
{
"bar"
})
}
func
TestTagMultipleDestinations
(
t
*
testing
.
T
)
{
tag
:=
Tag
{
Source
:
"foo"
,
Destinations
:
[]
string
{
"bar"
,
"baz"
},
}
assert
.
NoError
(
t
,
tag
.
Valid
())
}
func
TestTagMergedDestinations
(
t
*
testing
.
T
)
{
tag
:=
Tag
{
Source
:
"foo"
,
Destination
:
"bar"
,
Destinations
:
[]
string
{
"baz"
},
}
assert
.
NoError
(
t
,
tag
.
Valid
())
assert
.
Equal
(
t
,
tag
.
Destinations
,
yaml
.
StringOrSlice
{
"bar"
,
"baz"
})
}
func
TestTagSourceRequired
(
t
*
testing
.
T
)
{
tag
:=
Tag
{
Destination
:
"bar"
,
}
assert
.
ErrorIs
(
t
,
tag
.
Valid
(),
podman
.
ErrNoImage
)
}
func
TestTagDestinationsRequired
(
t
*
testing
.
T
)
{
tag
:=
Tag
{
Source
:
"foo"
,
}
assert
.
ErrorIs
(
t
,
tag
.
Valid
(),
podman
.
ErrNoTargets
)
}