summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-12-23 11:02:52 -0600
committerbaude <bbaude@redhat.com>2020-12-23 12:01:46 -0600
commitc81e29525b0ea84107147d92283c2b88909d1f12 (patch)
treee88e9e8d36811858ecfa026b9ed280f50ee83bae /test/e2e
parent54b82a175f16f27849e6791f65bf73eccae4701a (diff)
downloadpodman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.gz
podman-c81e29525b0ea84107147d92283c2b88909d1f12.tar.bz2
podman-c81e29525b0ea84107147d92283c2b88909d1f12.zip
add --cidfile to container kill
Add the ability to read container ids from one or more files for the kill command. Fixes: #8443 Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/kill_test.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index 8a4828583..8b31cae72 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "io/ioutil"
"os"
. "github.com/containers/podman/v2/test/utils"
@@ -112,4 +113,58 @@ var _ = Describe("Podman kill", func() {
Expect(result.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
})
+
+ It("podman kill --cidfile", func() {
+ tmpDir, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ tmpFile := tmpDir + "cid"
+ defer os.RemoveAll(tmpDir)
+
+ session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToStringArray()[0]
+
+ kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile})
+ kill.WaitWithDefaultTimeout()
+ Expect(kill.ExitCode()).To(BeZero())
+
+ wait := podmanTest.Podman([]string{"wait", "--condition", "exited", cid})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait.ExitCode()).To(BeZero())
+ })
+
+ It("podman kill multiple --cidfile", func() {
+ tmpDir1, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ tmpFile1 := tmpDir1 + "cid"
+ defer os.RemoveAll(tmpDir1)
+
+ tmpDir2, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ tmpFile2 := tmpDir2 + "cid"
+ defer os.RemoveAll(tmpDir2)
+
+ session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile1, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid1 := session.OutputToStringArray()[0]
+
+ session2 := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile2, ALPINE, "top"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(Equal(0))
+ cid2 := session2.OutputToStringArray()[0]
+
+ kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
+ kill.WaitWithDefaultTimeout()
+ Expect(kill.ExitCode()).To(BeZero())
+
+ wait := podmanTest.Podman([]string{"wait", "--condition", "exited", cid1})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait.ExitCode()).To(BeZero())
+ wait = podmanTest.Podman([]string{"wait", "--condition", "exited", cid2})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait.ExitCode()).To(BeZero())
+ })
+
})