diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-11-03 12:04:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 12:04:26 -0500 |
commit | 2a6e96e7ae1ecc00aa94b52194b7ec285be28989 (patch) | |
tree | 1a4224ec45f2a50c5d6c4292e3d836511d508768 /test/e2e | |
parent | 96358824f6eb9a8a4c42abea5d5422fe42ecb106 (diff) | |
parent | b00a195ba2d33972051ec5445331c251ca44c0b0 (diff) | |
download | podman-2a6e96e7ae1ecc00aa94b52194b7ec285be28989.tar.gz podman-2a6e96e7ae1ecc00aa94b52194b7ec285be28989.tar.bz2 podman-2a6e96e7ae1ecc00aa94b52194b7ec285be28989.zip |
Merge pull request #8226 from debarshiray/wip/rishi/toolbox_test-userns-keepid-HOME
Test $HOME when it's parent is bind mounted with --userns=keep-id
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/toolbox_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index fbff8d19e..822159fc2 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -30,10 +30,12 @@ import ( "os" "os/exec" "os/user" + "path" "strconv" "strings" "syscall" + "github.com/containers/podman/v2/pkg/rootless" . "github.com/containers/podman/v2/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -371,10 +373,23 @@ var _ = Describe("Toolbox-specific testing", func() { currentUser, err := user.Current() Expect(err).To(BeNil()) + session = podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:%s", currentUser.HomeDir, currentUser.HomeDir), "--userns=keep-id", fedoraToolbox, "sh", "-c", "echo $HOME"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring(currentUser.HomeDir)) + + if rootless.IsRootless() { + location := path.Dir(currentUser.HomeDir) + volumeArg := fmt.Sprintf("%s:%s", location, location) + session = podmanTest.Podman([]string{"run", + "--userns=keep-id", + "--volume", volumeArg, + fedoraToolbox, "sh", "-c", "echo $HOME"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring(currentUser.HomeDir)) + } }) }) |