github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/test/e2e/tag_test.go (about) 1 package integration 2 3 import ( 4 "os" 5 6 . "github.com/containers/podman/v2/test/utils" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Podman tag", func() { 12 var ( 13 tempdir string 14 err error 15 podmanTest *PodmanTestIntegration 16 ) 17 18 BeforeEach(func() { 19 tempdir, err = CreateTempDirInTempDir() 20 if err != nil { 21 os.Exit(1) 22 } 23 podmanTest = PodmanTestCreate(tempdir) 24 podmanTest.Setup() 25 podmanTest.AddImageToRWStore(ALPINE) 26 }) 27 28 AfterEach(func() { 29 podmanTest.Cleanup() 30 f := CurrentGinkgoTestDescription() 31 processTestResult(f) 32 33 }) 34 35 It("podman tag shortname:latest", func() { 36 session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:latest"}) 37 session.WaitWithDefaultTimeout() 38 Expect(session.ExitCode()).To(Equal(0)) 39 40 results := podmanTest.Podman([]string{"inspect", "foobar:latest"}) 41 results.WaitWithDefaultTimeout() 42 Expect(results.ExitCode()).To(Equal(0)) 43 inspectData := results.InspectImageJSON() 44 Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) 45 Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) 46 }) 47 48 It("podman tag shortname", func() { 49 session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"}) 50 session.WaitWithDefaultTimeout() 51 Expect(session.ExitCode()).To(Equal(0)) 52 53 results := podmanTest.Podman([]string{"inspect", "foobar:latest"}) 54 results.WaitWithDefaultTimeout() 55 Expect(results.ExitCode()).To(Equal(0)) 56 inspectData := results.InspectImageJSON() 57 Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) 58 Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) 59 }) 60 61 It("podman tag shortname:tag", func() { 62 session := podmanTest.Podman([]string{"tag", ALPINE, "foobar:new"}) 63 session.WaitWithDefaultTimeout() 64 Expect(session.ExitCode()).To(Equal(0)) 65 66 results := podmanTest.Podman([]string{"inspect", "foobar:new"}) 67 results.WaitWithDefaultTimeout() 68 Expect(results.ExitCode()).To(Equal(0)) 69 inspectData := results.InspectImageJSON() 70 Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) 71 Expect(StringInSlice("localhost/foobar:new", inspectData[0].RepoTags)).To(BeTrue()) 72 }) 73 74 It("podman tag shortname image no tag", func() { 75 session := podmanTest.Podman([]string{"tag", ALPINE, "foobar"}) 76 session.WaitWithDefaultTimeout() 77 Expect(session.ExitCode()).To(Equal(0)) 78 79 results := podmanTest.Podman([]string{"tag", "foobar", "barfoo"}) 80 results.WaitWithDefaultTimeout() 81 Expect(results.ExitCode()).To(Equal(0)) 82 83 verify := podmanTest.Podman([]string{"inspect", "barfoo"}) 84 verify.WaitWithDefaultTimeout() 85 Expect(verify.ExitCode()).To(Equal(0)) 86 }) 87 })