summaryrefslogtreecommitdiff
path: root/test/e2e/exec_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-03-26 16:23:24 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-03-26 23:27:00 +0000
commita3156da21ccd830639ff5699c13da82f3062439b (patch)
tree998cb5ec5553dd2c96703e164a47afc97e7417e9 /test/e2e/exec_test.go
parentb18f089545b27aaa09b565651851822d18ef0dc3 (diff)
downloadpodman-a3156da21ccd830639ff5699c13da82f3062439b.tar.gz
podman-a3156da21ccd830639ff5699c13da82f3062439b.tar.bz2
podman-a3156da21ccd830639ff5699c13da82f3062439b.zip
podman exec should handle options --env foo
If the user does not specify foo=bar, then the exec code should look for the foo environment variable in its environment and pass it in. This is the way podman run works. Also added tests to make sure this all works. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #552 Approved by: mheon
Diffstat (limited to 'test/e2e/exec_test.go')
-rw-r--r--test/e2e/exec_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 95068a774..c64c8666c 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -59,4 +59,32 @@ var _ = Describe("Podman exec", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman exec environment test", func() {
+ setup := podmanTest.RunTopContainer("test1")
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"exec", "-l", "--env", "FOO=BAR", "printenv", "FOO"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ match, _ := session.GrepString("BAR")
+ Expect(match).Should(BeTrue())
+
+ session = podmanTest.Podman([]string{"exec", "-l", "--env", "PATH=/bin", "printenv", "PATH"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ match, _ = session.GrepString("/bin")
+ Expect(match).Should(BeTrue())
+
+ os.Setenv("FOO", "BAR")
+ session = podmanTest.Podman([]string{"exec", "-l", "--env", "FOO", "printenv", "FOO"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ match, _ = session.GrepString("BAR")
+ Expect(match).Should(BeTrue())
+ os.Unsetenv("FOO")
+
+ })
+
})