grim/convey
Clone
Summary
Browse
Changes
Graph
Add a docker/build task for backwards compatibility
redux
2021-10-11, Gary Kramlich
ee239409c3de
Add a docker/build task for backwards compatibility
package
docker
import
(
"testing"
.
"github.com/onsi/gomega"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/yaml"
)
func
TestTagSingleDestination
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
tag
:=
Tag
{
Source
:
"foo"
,
Destination
:
"bar"
,
}
g
.
Expect
(
tag
.
Valid
()).
To
(
BeNil
())
g
.
Expect
(
tag
.
Destinations
).
To
(
Equal
(
yaml
.
StringOrSlice
{
"bar"
}))
}
func
TestTagMultipleDestinations
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
tag
:=
Tag
{
Source
:
"foo"
,
Destinations
:
[]
string
{
"bar"
,
"baz"
},
}
g
.
Expect
(
tag
.
Valid
()).
To
(
BeNil
())
}
func
TestTagMergedDestinations
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
tag
:=
Tag
{
Source
:
"foo"
,
Destination
:
"bar"
,
Destinations
:
[]
string
{
"baz"
},
}
g
.
Expect
(
tag
.
Valid
()).
To
(
BeNil
())
g
.
Expect
(
tag
.
Destinations
).
To
(
Equal
(
yaml
.
StringOrSlice
{
"bar"
,
"baz"
}))
}
func
TestTagSourceRequired
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
tag
:=
Tag
{
Destination
:
"bar"
,
}
g
.
Expect
(
tag
.
Valid
()).
To
(
MatchError
(
podman
.
ErrNoImage
))
}
func
TestTagDestinationsRequired
(
t
*
testing
.
T
)
{
g
:=
NewGomegaWithT
(
t
)
tag
:=
Tag
{
Source
:
"foo"
,
}
g
.
Expect
(
tag
.
Valid
()).
To
(
MatchError
(
podman
.
ErrNoTargets
))
}