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