github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/e2e/tree_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	. "github.com/containers/podman/v3/test/utils"
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	. "github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var _ = Describe("Podman image tree", func() {
    14  	var (
    15  		tempdir    string
    16  		err        error
    17  		podmanTest *PodmanTestIntegration
    18  	)
    19  
    20  	BeforeEach(func() {
    21  		tempdir, err = CreateTempDirInTempDir()
    22  		if err != nil {
    23  			os.Exit(1)
    24  		}
    25  		podmanTest = PodmanTestCreate(tempdir)
    26  		podmanTest.Setup()
    27  		podmanTest.AddImageToRWStore(BB)
    28  	})
    29  
    30  	AfterEach(func() {
    31  		podmanTest.Cleanup()
    32  		f := CurrentGinkgoTestDescription()
    33  		timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
    34  		GinkgoWriter.Write([]byte(timedResult))
    35  	})
    36  
    37  	It("podman image tree", func() {
    38  		SkipIfRemote("podman-image-tree is not supported for remote clients")
    39  		podmanTest.AddImageToRWStore(cirros)
    40  		dockerfile := `FROM quay.io/libpod/cirros: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.Podman([]string{"image", "tree", "test:latest"})
    48  		session.WaitWithDefaultTimeout()
    49  		Expect(session).Should(Exit(0))
    50  		session = podmanTest.Podman([]string{"image", "tree", "--whatrequires", "quay.io/libpod/cirros:latest"})
    51  		session.WaitWithDefaultTimeout()
    52  		Expect(session).Should(Exit(0))
    53  
    54  		session = podmanTest.Podman([]string{"rmi", "test:latest"})
    55  		session.WaitWithDefaultTimeout()
    56  		Expect(session).Should(Exit(0))
    57  		session = podmanTest.Podman([]string{"rmi", "quay.io/libpod/cirros:latest"})
    58  		session.WaitWithDefaultTimeout()
    59  		Expect(session).Should(Exit(0))
    60  	})
    61  })