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

     1  package integration
     2  
     3  import (
     4  	. "github.com/containers/podman/v4/test/utils"
     5  	. "github.com/onsi/ginkgo/v2"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("Podman mount", func() {
    10  
    11  	BeforeEach(func() {
    12  		SkipIfNotRootless("This function is not enabled for rootful podman")
    13  		SkipIfRemote("Podman mount not supported for remote connections")
    14  	})
    15  
    16  	It("podman mount", func() {
    17  		setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
    18  		setup.WaitWithDefaultTimeout()
    19  		Expect(setup).Should(ExitCleanly())
    20  		cid := setup.OutputToString()
    21  
    22  		mount := podmanTest.Podman([]string{"mount", cid})
    23  		mount.WaitWithDefaultTimeout()
    24  		Expect(mount).To(ExitWithError())
    25  		Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
    26  	})
    27  
    28  	It("podman unshare podman mount", func() {
    29  		setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
    30  		setup.WaitWithDefaultTimeout()
    31  		Expect(setup).Should(ExitCleanly())
    32  		cid := setup.OutputToString()
    33  
    34  		// command: podman <options> unshare podman <options> mount cid
    35  		args := []string{"unshare", podmanTest.PodmanBinary}
    36  		opts := podmanTest.PodmanMakeOptions([]string{"mount", cid}, false, false)
    37  		args = append(args, opts...)
    38  
    39  		// container root file system location is podmanTest.TempDir/...
    40  		// because "--root podmanTest.TempDir/..."
    41  		session := podmanTest.Podman(args)
    42  		session.WaitWithDefaultTimeout()
    43  		Expect(session).Should(ExitCleanly())
    44  		Expect(session.OutputToString()).To(ContainSubstring(podmanTest.TempDir))
    45  	})
    46  
    47  	It("podman image mount", func() {
    48  		podmanTest.AddImageToRWStore(ALPINE)
    49  		mount := podmanTest.Podman([]string{"image", "mount", ALPINE})
    50  		mount.WaitWithDefaultTimeout()
    51  		Expect(mount).To(ExitWithError())
    52  		Expect(mount.ErrorToString()).To(ContainSubstring("podman unshare"))
    53  	})
    54  
    55  	It("podman unshare image podman mount", func() {
    56  		podmanTest.AddImageToRWStore(CITEST_IMAGE)
    57  
    58  		// command: podman <options> unshare podman <options> image mount IMAGE
    59  		args := []string{"unshare", podmanTest.PodmanBinary}
    60  		opts := podmanTest.PodmanMakeOptions([]string{"image", "mount", CITEST_IMAGE}, false, false)
    61  		args = append(args, opts...)
    62  
    63  		// image location is podmanTest.TempDir/... because "--root podmanTest.TempDir/..."
    64  		session := podmanTest.Podman(args)
    65  		session.WaitWithDefaultTimeout()
    66  		Expect(session).Should(ExitCleanly())
    67  		Expect(session.OutputToString()).To(ContainSubstring(podmanTest.TempDir))
    68  	})
    69  })