github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/pod_inspect_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 pod inspect", 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.SeedImages()
    26  	})
    27  
    28  	AfterEach(func() {
    29  		podmanTest.CleanupPod()
    30  		f := CurrentGinkgoTestDescription()
    31  		processTestResult(f)
    32  
    33  	})
    34  
    35  	It("podman inspect bogus pod", func() {
    36  		session := podmanTest.Podman([]string{"pod", "inspect", "foobar"})
    37  		session.WaitWithDefaultTimeout()
    38  		Expect(session).Should(ExitWithError())
    39  	})
    40  
    41  	It("podman inspect a pod", func() {
    42  		_, ec, podid := podmanTest.CreatePod("")
    43  		Expect(ec).To(Equal(0))
    44  
    45  		session := podmanTest.RunTopContainerInPod("", podid)
    46  		session.WaitWithDefaultTimeout()
    47  		Expect(session.ExitCode()).To(Equal(0))
    48  
    49  		session = podmanTest.RunTopContainerInPod("", podid)
    50  		session.WaitWithDefaultTimeout()
    51  		Expect(session.ExitCode()).To(Equal(0))
    52  
    53  		inspect := podmanTest.Podman([]string{"pod", "inspect", podid})
    54  		inspect.WaitWithDefaultTimeout()
    55  		Expect(inspect.ExitCode()).To(Equal(0))
    56  		Expect(inspect.IsJSONOutputValid()).To(BeTrue())
    57  		podData := inspect.InspectPodToJSON()
    58  		Expect(podData.Config.ID).To(Equal(podid))
    59  	})
    60  })