github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/test/e2e/mount_rootless_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"os"
     5  
     6  	. "github.com/hanks177/podman/v4/test/utils"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  	. "github.com/onsi/gomega/gexec"
    10  )
    11  
    12  var _ = Describe("Podman mount", func() {
    13  	var (
    14  		tempdir    string
    15  		err        error
    16  		podmanTest *PodmanTestIntegration
    17  	)
    18  
    19  	BeforeEach(func() {
    20  		SkipIfNotRootless("This function is not enabled for rootful podman")
    21  		SkipIfRemote("Podman mount not supported for remote connections")
    22  		tempdir, err = CreateTempDirInTempDir()
    23  		if err != nil {
    24  			os.Exit(1)
    25  		}
    26  		podmanTest = PodmanTestCreate(tempdir)
    27  		podmanTest.Setup()
    28  	})
    29  
    30  	AfterEach(func() {
    31  		podmanTest.Cleanup()
    32  		f := CurrentGinkgoTestDescription()
    33  		processTestResult(f)
    34  
    35  	})
    36  
    37  	It("podman mount", func() {
    38  		setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
    39  		setup.WaitWithDefaultTimeout()
    40  		Expect(setup).Should(Exit(0))
    41  		cid := setup.OutputToString()
    42  
    43  		mount := podmanTest.Podman([]string{"mount", cid})
    44  		mount.WaitWithDefaultTimeout()
    45  		Expect(mount).To(ExitWithError())
    46  		Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
    47  	})
    48  
    49  	It("podman unshare podman mount", func() {
    50  		setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
    51  		setup.WaitWithDefaultTimeout()
    52  		Expect(setup).Should(Exit(0))
    53  		cid := setup.OutputToString()
    54  
    55  		session := podmanTest.Podman([]string{"unshare", PODMAN_BINARY, "mount", cid})
    56  		session.WaitWithDefaultTimeout()
    57  		Expect(setup).Should(Exit(0))
    58  	})
    59  
    60  	It("podman image mount", func() {
    61  		podmanTest.AddImageToRWStore(ALPINE)
    62  		mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
    63  		mount.WaitWithDefaultTimeout()
    64  		Expect(mount).To(ExitWithError())
    65  		Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
    66  	})
    67  
    68  	It("podman unshare image podman mount", func() {
    69  		podmanTest.AddImageToRWStore(ALPINE)
    70  		setup := podmanTest.Podman([]string{"pull", ALPINE})
    71  		setup.WaitWithDefaultTimeout()
    72  		Expect(setup).Should(Exit(0))
    73  
    74  		session := podmanTest.Podman([]string{"unshare", PODMAN_BINARY, "image", "mount", ALPINE})
    75  		session.WaitWithDefaultTimeout()
    76  		Expect(setup).Should(Exit(0))
    77  	})
    78  })