github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/tree_test.go (about) 1 package integration 2 3 import ( 4 "fmt" 5 "os" 6 7 . "github.com/containers/libpod/test/utils" 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 ) 11 12 var _ = Describe("Podman image tree", 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.RestoreArtifact(BB) 27 }) 28 29 AfterEach(func() { 30 podmanTest.Cleanup() 31 f := CurrentGinkgoTestDescription() 32 timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) 33 GinkgoWriter.Write([]byte(timedResult)) 34 }) 35 36 It("podman image tree", func() { 37 if podmanTest.RemoteTest { 38 Skip("Does not work on remote client") 39 } 40 dockerfile := `FROM docker.io/library/busybox:latest 41 RUN mkdir hello 42 RUN touch test.txt 43 ENV foo=bar 44 ` 45 podmanTest.BuildImage(dockerfile, "test:latest", "true") 46 47 session := podmanTest.PodmanNoCache([]string{"image", "tree", "test:latest"}) 48 session.WaitWithDefaultTimeout() 49 Expect(session.ExitCode()).To(Equal(0)) 50 session = podmanTest.PodmanNoCache([]string{"image", "tree", "--whatrequires", "docker.io/library/busybox:latest"}) 51 session.WaitWithDefaultTimeout() 52 Expect(session.ExitCode()).To(Equal(0)) 53 54 session = podmanTest.PodmanNoCache([]string{"rmi", "test:latest"}) 55 session.WaitWithDefaultTimeout() 56 Expect(session.ExitCode()).To(Equal(0)) 57 session = podmanTest.PodmanNoCache([]string{"rmi", "docker.io/library/busybox:latest"}) 58 session.WaitWithDefaultTimeout() 59 Expect(session.ExitCode()).To(Equal(0)) 60 }) 61 })