diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-21 16:02:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-21 16:02:52 +0200 |
commit | a852afab2f37026fa8a45d115c61cd77fb3e7ef1 (patch) | |
tree | f47d5211873d31dadb3b89b69d66397c744b2231 /test | |
parent | 500ad31d1bd1aee1458b17f05c2dfb7937786e87 (diff) | |
parent | 24158d4a2eaa84088ca1ca1e85a0bcbb8399c2ac (diff) | |
download | podman-a852afab2f37026fa8a45d115c61cd77fb3e7ef1.tar.gz podman-a852afab2f37026fa8a45d115c61cd77fb3e7ef1.tar.bz2 podman-a852afab2f37026fa8a45d115c61cd77fb3e7ef1.zip |
Merge pull request #6270 from mheon/detached_exec
Implement detached exec
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/exec_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index da80bba47..87dddb233 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -283,4 +283,31 @@ var _ = Describe("Podman exec", func() { Expect(exec.ExitCode()).To(Equal(0)) Expect(strings.Contains(exec.OutputToString(), fmt.Sprintf("%s(%s)", gid, groupName))).To(BeTrue()) }) + + It("podman exec --detach", func() { + ctrName := "testctr" + ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"}) + ctr.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + + exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", "-d", ctrName, "top"}) + exec1.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + + data := podmanTest.InspectContainer(ctrName) + Expect(len(data)).To(Equal(1)) + Expect(len(data[0].ExecIDs)).To(Equal(1)) + Expect(strings.Contains(exec1.OutputToString(), data[0].ExecIDs[0])).To(BeTrue()) + + exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "ps", "-a"}) + exec2.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + Expect(strings.Count(exec2.OutputToString(), "top")).To(Equal(2)) + + // Ensure that stop with a running detached exec session is + // clean. + stop := podmanTest.Podman([]string{"stop", ctrName}) + stop.WaitWithDefaultTimeout() + Expect(stop.ExitCode()).To(Equal(0)) + }) }) |