summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-08-21 14:27:31 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-23 12:07:59 +0000
commitc3ec44b5a7ad29ad44d169ca4344ced51a78d617 (patch)
tree7ed037a00a466019ca464a25a1b21fe94b4e5bf3
parentc276a13880c59054beda7ecfa04b36e4588570f8 (diff)
downloadpodman-c3ec44b5a7ad29ad44d169ca4344ced51a78d617.tar.gz
podman-c3ec44b5a7ad29ad44d169ca4344ced51a78d617.tar.bz2
podman-c3ec44b5a7ad29ad44d169ca4344ced51a78d617.zip
Add tests for exec --user
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #1315 Approved by: vrothberg
-rw-r--r--test/e2e/exec_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 74286494e..da18f09a3 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -100,4 +100,29 @@ var _ = Describe("Podman exec", func() {
Expect(session.ExitCode()).To(Equal(100))
})
+ It("podman exec simple command with user", func() {
+ setup := podmanTest.RunTopContainer("test1")
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"exec", "--user", "root", "test1", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
+ It("podman exec with user only in container", func() {
+ testUser := "test123"
+ setup := podmanTest.RunTopContainer("test1")
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"exec", "test1", "useradd", testUser})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session2 := podmanTest.Podman([]string{"exec", "--user", testUser, "test1", "whoami"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(Equal(0))
+ Expect(session2.OutputToString()).To(Equal(testUser))
+ })
})