summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-08-20 11:35:33 -0400
committerPeter Hunt <pehunt@redhat.com>2019-08-20 11:44:27 -0400
commitcc3d8da9683414bda2b650cb46a0b54ce0e6a263 (patch)
tree61fcea462a84857f2c8d4d0f258101fc2d3a2a5f /test
parent34fc1d09d245cbd0d922562860f639667c8641d6 (diff)
downloadpodman-cc3d8da9683414bda2b650cb46a0b54ce0e6a263.tar.gz
podman-cc3d8da9683414bda2b650cb46a0b54ce0e6a263.tar.bz2
podman-cc3d8da9683414bda2b650cb46a0b54ce0e6a263.zip
exec: run with user specified on container start
Before, if the container was run with a specified user that wasn't root, exec would fail because it always set to root unless respecified by user. instead, inherit the user from the container start. Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/exec_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index ac727f9bc..f3190978c 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -146,6 +146,25 @@ var _ = Describe("Podman exec", func() {
Expect(session2.OutputToString()).To(Equal(testUser))
})
+ It("podman exec with user from run", func() {
+ testUser := "guest"
+ setup := podmanTest.Podman([]string{"run", "--user", testUser, "-d", ALPINE, "top"})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+ ctrID := setup.OutputToString()
+
+ session := podmanTest.Podman([]string{"exec", ctrID, "whoami"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(testUser))
+
+ overrideUser := "root"
+ session = podmanTest.Podman([]string{"exec", "--user", overrideUser, ctrID, "whoami"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(overrideUser))
+ })
+
It("podman exec simple working directory test", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()