summaryrefslogtreecommitdiff
path: root/test/e2e/exec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/exec_test.go')
-rw-r--r--test/e2e/exec_test.go43
1 files changed, 36 insertions, 7 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 055546f88..7d50c02b2 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -67,13 +67,14 @@ var _ = Describe("Podman exec", func() {
})
It("podman exec simple command using latest", func() {
- // the remote client doesn't use latest
- SkipIfRemote()
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
-
- session := podmanTest.Podman([]string{"exec", "-l", "ls"})
+ cid := "-l"
+ if IsRemote() {
+ cid = "test1"
+ }
+ session := podmanTest.Podman([]string{"exec", cid, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@@ -122,13 +123,12 @@ var _ = Describe("Podman exec", func() {
})
It("podman exec terminal doesn't hang", func() {
- Skip(v2remotefail)
- setup := podmanTest.Podman([]string{"run", "-dti", fedoraMinimal, "sleep", "+Inf"})
+ setup := podmanTest.Podman([]string{"run", "-dti", "--name", "test1", fedoraMinimal, "sleep", "+Inf"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
for i := 0; i < 5; i++ {
- session := podmanTest.Podman([]string{"exec", "-lti", "true"})
+ session := podmanTest.Podman([]string{"exec", "-ti", "test1", "true"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
}
@@ -283,6 +283,35 @@ var _ = Describe("Podman exec", func() {
Expect(strings.Contains(exec.OutputToString(), fmt.Sprintf("%s(%s)", gid, groupName))).To(BeTrue())
})
+ It("podman exec preserves container groups with --user and --group-add", func() {
+ SkipIfRemote("FIXME: This is broken SECCOMP Failues?")
+
+ dockerfile := `FROM fedora-minimal
+RUN groupadd -g 4000 first
+RUN groupadd -g 4001 second
+RUN useradd -u 1000 auser`
+ imgName := "testimg"
+ podmanTest.BuildImage(dockerfile, imgName, "false")
+
+ ctrName := "testctr"
+ ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, "--user", "auser:first", "--group-add", "second", imgName, "sleep", "300"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(Equal(0))
+
+ exec := podmanTest.Podman([]string{"exec", "-t", ctrName, "id"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(Equal(0))
+ output := exec.OutputToString()
+ Expect(strings.Contains(output, "4000(first)")).To(BeTrue())
+ Expect(strings.Contains(output, "4001(second)")).To(BeTrue())
+ Expect(strings.Contains(output, "1000(auser)")).To(BeTrue())
+
+ // Kill the container just so the test does not take 15 seconds to stop.
+ kill := podmanTest.Podman([]string{"kill", ctrName})
+ kill.WaitWithDefaultTimeout()
+ Expect(kill.ExitCode()).To(Equal(0))
+ })
+
It("podman exec --detach", func() {
ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"})