github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/tag_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"os"
     5  
     6  	. "github.com/containers/libpod/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.RestoreAllArtifacts()
    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.PodmanNoCache([]string{"tag", ALPINE, "foobar:latest"})
    37  		session.WaitWithDefaultTimeout()
    38  		Expect(session.ExitCode()).To(Equal(0))
    39  
    40  		results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:latest"})
    41  		results.WaitWithDefaultTimeout()
    42  		Expect(results.ExitCode()).To(Equal(0))
    43  		inspectData := results.InspectImageJSON()
    44  		Expect(StringInSlice("docker.io/library/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.PodmanNoCache([]string{"tag", ALPINE, "foobar"})
    50  		session.WaitWithDefaultTimeout()
    51  		Expect(session.ExitCode()).To(Equal(0))
    52  
    53  		results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:latest"})
    54  		results.WaitWithDefaultTimeout()
    55  		Expect(results.ExitCode()).To(Equal(0))
    56  		inspectData := results.InspectImageJSON()
    57  		Expect(StringInSlice("docker.io/library/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.PodmanNoCache([]string{"tag", ALPINE, "foobar:new"})
    63  		session.WaitWithDefaultTimeout()
    64  		Expect(session.ExitCode()).To(Equal(0))
    65  
    66  		results := podmanTest.PodmanNoCache([]string{"inspect", "foobar:new"})
    67  		results.WaitWithDefaultTimeout()
    68  		Expect(results.ExitCode()).To(Equal(0))
    69  		inspectData := results.InspectImageJSON()
    70  		Expect(StringInSlice("docker.io/library/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.PodmanNoCache([]string{"tag", ALPINE, "foobar"})
    76  		session.WaitWithDefaultTimeout()
    77  		Expect(session.ExitCode()).To(Equal(0))
    78  
    79  		results := podmanTest.PodmanNoCache([]string{"tag", "foobar", "barfoo"})
    80  		results.WaitWithDefaultTimeout()
    81  		Expect(results.ExitCode()).To(Equal(0))
    82  
    83  		verify := podmanTest.PodmanNoCache([]string{"inspect", "barfoo"})
    84  		verify.WaitWithDefaultTimeout()
    85  		Expect(verify.ExitCode()).To(Equal(0))
    86  	})
    87  })