summaryrefslogtreecommitdiff
path: root/test/e2e/pod_rm_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-11 10:56:11 -0400
committerGitHub <noreply@github.com>2020-06-11 10:56:11 -0400
commit39ad0387ca27097875b02b55c6f71c2f2b8bdd6c (patch)
tree0c870e02eb98c1f1db60d5dd44e7ebf2a7450335 /test/e2e/pod_rm_test.go
parentf1b6840382ffdfe9811c64b3aea75218d9b14e5e (diff)
parentc7c81a8c081f6f7458345027f315a796d6ca5eda (diff)
downloadpodman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.tar.gz
podman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.tar.bz2
podman-39ad0387ca27097875b02b55c6f71c2f2b8bdd6c.zip
Merge pull request #6415 from vrothberg/systemd-new-pod
podman-generate-systemd --new for pods
Diffstat (limited to 'test/e2e/pod_rm_test.go')
-rw-r--r--test/e2e/pod_rm_test.go69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 4060e1268..d0ece7b53 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -2,6 +2,7 @@ package integration
import (
"fmt"
+ "io/ioutil"
"os"
"path/filepath"
"strings"
@@ -229,4 +230,72 @@ var _ = Describe("Podman pod rm", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman pod start/remove single pod via --pod-id-file", func() {
+ tmpDir, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ tmpFile := tmpDir + "podID"
+ defer os.RemoveAll(tmpDir)
+
+ podName := "rudolph"
+
+ // Create a pod with --pod-id-file.
+ session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Create container inside the pod.
+ session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
+
+ session = podmanTest.Podman([]string{"pod", "rm", "--pod-id-file", tmpFile, "--force"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
+
+ It("podman pod start/remove multiple pods via --pod-id-file", func() {
+ tmpDir, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ defer os.RemoveAll(tmpDir)
+
+ podIDFiles := []string{}
+ for _, i := range "0123456789" {
+ tmpFile := tmpDir + "cid" + string(i)
+ podName := "rudolph" + string(i)
+ // Create a pod with --pod-id-file.
+ session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Create container inside the pod.
+ session = podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // Append the id files along with the command.
+ podIDFiles = append(podIDFiles, "--pod-id-file")
+ podIDFiles = append(podIDFiles, tmpFile)
+ }
+
+ cmd := []string{"pod", "start"}
+ cmd = append(cmd, podIDFiles...)
+ session := podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(20)) // 10*(infra+top)
+
+ cmd = []string{"pod", "rm", "--force"}
+ cmd = append(cmd, podIDFiles...)
+ session = podmanTest.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
})