summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-09-20 14:45:20 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-09-20 16:01:38 +0200
commite42e1c45ae761b203dd5312c22ee7992eef322dc (patch)
tree1f70235f041c4ac9aa083b9014b6615d707e5430 /test
parent7ed1816900b9e1cc8087f8256e836eb62d0c6295 (diff)
downloadpodman-e42e1c45ae761b203dd5312c22ee7992eef322dc.tar.gz
podman-e42e1c45ae761b203dd5312c22ee7992eef322dc.tar.bz2
podman-e42e1c45ae761b203dd5312c22ee7992eef322dc.zip
container: make sure $HOME is always set
If the HOME environment variable is not set, make sure it is set to the configuration found in the container /etc/passwd file. It was previously depending on a runc behavior that always set HOME when it is not set. The OCI runtime specifications do not require HOME to be set so move the logic to libpod. Closes: https://github.com/debarshiray/toolbox/issues/266 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_test.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 4d2cee8e3..55920467c 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -194,10 +194,22 @@ var _ = Describe("Podman run", func() {
})
It("podman run environment test", func() {
- session := podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
+ session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOME"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- match, _ := session.GrepString("BAR,BAZ")
+ match, _ := session.GrepString("/root")
+ Expect(match).Should(BeTrue())
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--env", "HOME=/foo", ALPINE, "printenv", "HOME"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ match, _ = session.GrepString("/foo")
+ Expect(match).Should(BeTrue())
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ match, _ = session.GrepString("BAR,BAZ")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--env", "PATH=/bin", ALPINE, "printenv", "PATH"})