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

     1  package integration
     2  
     3  import (
     4  	"os"
     5  
     6  	. "github.com/containers/podman/v3/test/utils"
     7  	"github.com/containers/storage/pkg/stringid"
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	. "github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var _ = Describe("Podman volume exists", 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.SeedImages()
    28  	})
    29  
    30  	AfterEach(func() {
    31  		podmanTest.CleanupVolume()
    32  		f := CurrentGinkgoTestDescription()
    33  		processTestResult(f)
    34  
    35  	})
    36  
    37  	It("podman volume exists", func() {
    38  		vol := "vol" + stringid.GenerateNonCryptoID()
    39  		session := podmanTest.Podman([]string{"volume", "create", vol})
    40  		session.WaitWithDefaultTimeout()
    41  		Expect(session).Should(Exit(0))
    42  
    43  		session = podmanTest.Podman([]string{"volume", "exists", vol})
    44  		session.WaitWithDefaultTimeout()
    45  		Expect(session).Should(Exit(0))
    46  
    47  		session = podmanTest.Podman([]string{"volume", "exists", stringid.GenerateNonCryptoID()})
    48  		session.WaitWithDefaultTimeout()
    49  		Expect(session).Should(Exit(1))
    50  	})
    51  })