summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/images_test.go22
-rw-r--r--test/e2e/libpod_suite_test.go36
2 files changed, 58 insertions, 0 deletions
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index ecc0f2415..e05281ac9 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -37,6 +37,28 @@ var _ = Describe("Podman images", func() {
Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue())
})
+ It("podman images with multiple tags", func() {
+ // tag "docker.io/library/alpine:latest" to "foo:{a,b,c}"
+ session := podmanTest.Podman([]string{"tag", ALPINE, "foo:a", "foo:b", "foo:c"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ // tag "foo:c" to "bar:{a,b}"
+ session = podmanTest.Podman([]string{"tag", "foo:c", "bar:a", "bar:b"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ // check all previous and the newly tagged images
+ session = podmanTest.Podman([]string{"images"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session.LineInOutputContainsTag("docker.io/library/alpine", "latest")
+ session.LineInOutputContainsTag("docker.io/library/busybox", "glibc")
+ session.LineInOutputContainsTag("foo", "a")
+ session.LineInOutputContainsTag("foo", "b")
+ session.LineInOutputContainsTag("foo", "c")
+ session.LineInOutputContainsTag("bar", "a")
+ session.LineInOutputContainsTag("bar", "b")
+ })
+
It("podman images with digests", func() {
session := podmanTest.Podman([]string{"images", "--digests"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index ed9694092..6938ea571 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -445,6 +445,42 @@ func (s *PodmanSession) LineInOuputContains(term string) bool {
return false
}
+//tagOutPutToMap parses each string in imagesOutput and returns
+// a map of repo:tag pairs. Notice, the first array item will
+// be skipped as it's considered to be the header.
+func tagOutputToMap(imagesOutput []string) map[string]string {
+ m := make(map[string]string)
+ // iterate over output but skip the header
+ for _, i := range imagesOutput[1:] {
+ tmp := []string{}
+ for _, x := range strings.Split(i, " ") {
+ if x != "" {
+ tmp = append(tmp, x)
+ }
+ }
+ // podman-images(1) return a list like output
+ // in the format of "Repository Tag [...]"
+ if len(tmp) < 2 {
+ continue
+ }
+ m[tmp[0]] = tmp[1]
+ }
+ return m
+}
+
+//LineInOutputContainsTag returns true if a line in the
+// session's output contains the repo-tag pair as returned
+// by podman-images(1).
+func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool {
+ tagMap := tagOutputToMap(s.OutputToStringArray())
+ for r, t := range tagMap {
+ if repo == r && tag == t {
+ return true
+ }
+ }
+ return false
+}
+
//GetContainerStatus returns the containers state.
// This function assumes only one container is active.
func (p *PodmanTest) GetContainerStatus() string {