github.com/containers/podman/v4@v4.9.4/test/e2e/volume_inspect_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"github.com/containers/podman/v4/libpod/define"
     5  	. "github.com/containers/podman/v4/test/utils"
     6  	. "github.com/onsi/ginkgo/v2"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("Podman volume inspect", func() {
    11  
    12  	AfterEach(func() {
    13  		podmanTest.CleanupVolume()
    14  	})
    15  
    16  	It("podman inspect volume", func() {
    17  		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
    18  		session.WaitWithDefaultTimeout()
    19  		volName := session.OutputToString()
    20  		Expect(session).Should(ExitCleanly())
    21  
    22  		session = podmanTest.Podman([]string{"volume", "inspect", volName})
    23  		session.WaitWithDefaultTimeout()
    24  		Expect(session).Should(ExitCleanly())
    25  		Expect(session.OutputToString()).To(BeValidJSON())
    26  	})
    27  
    28  	It("podman inspect volume with Go format", func() {
    29  		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
    30  		session.WaitWithDefaultTimeout()
    31  		volName := session.OutputToString()
    32  		Expect(session).Should(ExitCleanly())
    33  
    34  		session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", volName})
    35  		session.WaitWithDefaultTimeout()
    36  		Expect(session).Should(ExitCleanly())
    37  		Expect(session.OutputToString()).To(Equal(volName))
    38  	})
    39  
    40  	It("podman inspect volume with --all flag", func() {
    41  		session := podmanTest.Podman([]string{"volume", "create", "myvol1"})
    42  		session.WaitWithDefaultTimeout()
    43  		volName1 := session.OutputToString()
    44  		Expect(session).Should(ExitCleanly())
    45  
    46  		session = podmanTest.Podman([]string{"volume", "create", "myvol2"})
    47  		session.WaitWithDefaultTimeout()
    48  		volName2 := session.OutputToString()
    49  		Expect(session).Should(ExitCleanly())
    50  
    51  		session = podmanTest.Podman([]string{"volume", "inspect", "--format", "{{.Name}}", "--all"})
    52  		session.WaitWithDefaultTimeout()
    53  		Expect(session).Should(ExitCleanly())
    54  		Expect(session.OutputToStringArray()).To(HaveLen(2))
    55  		Expect(session.OutputToStringArray()[0]).To(Equal(volName1))
    56  		Expect(session.OutputToStringArray()[1]).To(Equal(volName2))
    57  	})
    58  
    59  	It("inspect volume finds options", func() {
    60  		volName := "testvol"
    61  		session := podmanTest.Podman([]string{"volume", "create", "--opt", "type=tmpfs", volName})
    62  		session.WaitWithDefaultTimeout()
    63  		Expect(session).Should(ExitCleanly())
    64  
    65  		inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
    66  		inspect.WaitWithDefaultTimeout()
    67  		Expect(inspect).Should(ExitCleanly())
    68  		Expect(inspect.OutputToString()).To(ContainSubstring(define.TypeTmpfs))
    69  	})
    70  })