summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-13 17:43:26 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-14 16:45:24 -0400
commit6ca80679561285859a00c1b6bf1fae2d071d7cc3 (patch)
tree323982252f541550012fd6585c1623704e884b00 /test
parentd1ba9ce555099ad4cf2fd49c4598edaae0bfe0e4 (diff)
downloadpodman-6ca80679561285859a00c1b6bf1fae2d071d7cc3.tar.gz
podman-6ca80679561285859a00c1b6bf1fae2d071d7cc3.tar.bz2
podman-6ca80679561285859a00c1b6bf1fae2d071d7cc3.zip
Setup HOME environment when using --userns=keep-id
Currently the HOME environment is set to /root if the user does not override it. Also walk the parent directories of users homedir to see if it is volume mounted into the container, if yes, then set it correctly. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/toolbox_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index 6122cee19..4f4113bd4 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -365,4 +365,16 @@ var _ = Describe("Toolbox-specific testing", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("READY"))
})
+
+ It("podman run --userns=keep-id check $HOME", func() {
+ var session *PodmanSessionIntegration
+
+ 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))
+ })
+
})