grim/convey

Start updating the documentation
redux
2021-10-16, Gary Kramlich
738aea24df10
Start updating the documentation
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))
}