From 2a7449362f2884d9ae6a783c0ce38979d882e2cf Mon Sep 17 00:00:00 2001 From: haircommander Date: Fri, 17 Aug 2018 10:36:51 -0400 Subject: Change pause container to infra container Signed-off-by: haircommander Closes: #1187 Approved by: mheon --- test/e2e/libpod_suite_test.go | 8 +- test/e2e/pod_infra_container_test.go | 285 +++++++++++++++++++++++++++++++++++ test/e2e/pod_pause_container_test.go | 285 ----------------------------------- test/e2e/pod_stats_test.go | 32 ++-- 4 files changed, 301 insertions(+), 309 deletions(-) create mode 100644 test/e2e/pod_infra_container_test.go delete mode 100644 test/e2e/pod_pause_container_test.go (limited to 'test/e2e') diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 019ba9377..8c9183450 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -32,7 +32,7 @@ var ( CGROUP_MANAGER = "systemd" STORAGE_OPTIONS = "--storage-driver vfs" ARTIFACT_DIR = "/tmp/.artifacts" - CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, pause} + CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra} RESTORE_IMAGES = []string{ALPINE, BB} ALPINE = "docker.io/library/alpine:latest" BB = "docker.io/library/busybox:latest" @@ -41,7 +41,7 @@ var ( nginx = "quay.io/baude/alpine_nginx:latest" redis = "docker.io/library/redis:alpine" registry = "docker.io/library/registry:2" - pause = "k8s.gcr.io/pause:3.1" + infra = "k8s.gcr.io/pause:3.1" defaultWaitTimeout = 90 ) @@ -423,10 +423,10 @@ func (p *PodmanTest) RestoreAllArtifacts() error { return nil } -// CreatePod creates a pod with no pause container +// CreatePod creates a pod with no infra container // it optionally takes a pod name func (p *PodmanTest) CreatePod(name string) (*PodmanSession, int, string) { - var podmanArgs = []string{"pod", "create", "--pause=false", "--share", ""} + var podmanArgs = []string{"pod", "create", "--infra=false", "--share", ""} if name != "" { podmanArgs = append(podmanArgs, "--name", name) } diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go new file mode 100644 index 000000000..2dcce6525 --- /dev/null +++ b/test/e2e/pod_infra_container_test.go @@ -0,0 +1,285 @@ +package integration + +import ( + "fmt" + "os" + "strconv" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Podman pod create", func() { + var ( + tempdir string + err error + podmanTest PodmanTest + ) + + BeforeEach(func() { + tempdir, err = CreateTempDirInTempDir() + if err != nil { + os.Exit(1) + } + podmanTest = PodmanCreate(tempdir) + podmanTest.RestoreAllArtifacts() + podmanTest.RestoreArtifact(infra) + }) + + AfterEach(func() { + podmanTest.CleanupPod() + f := CurrentGinkgoTestDescription() + timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) + GinkgoWriter.Write([]byte(timedResult)) + }) + + It("podman create infra container", func() { + session := podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"}) + check.WaitWithDefaultTimeout() + match, _ := check.GrepString(podID) + Expect(match).To(BeTrue()) + Expect(len(check.OutputToStringArray())).To(Equal(1)) + + check = podmanTest.Podman([]string{"ps", "-qa", "--no-trunc"}) + check.WaitWithDefaultTimeout() + Expect(len(check.OutputToStringArray())).To(Equal(1)) + }) + + It("podman start infra container", func() { + session := podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"ps", "-qa", "--no-trunc", "--filter", "status=running"}) + check.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(check.OutputToStringArray())).To(Equal(1)) + }) + + It("podman infra container namespaces", func() { + session := podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.RunTopContainerInPod("", podID) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"ps", "-a", "--no-trunc", "--ns", "--format", "{{.IPC}} {{.NET}}"}) + check.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(check.OutputToStringArray())).To(Equal(2)) + Expect(check.OutputToStringArray()[0]).To(Equal(check.OutputToStringArray()[1])) + + }) + + It("podman pod correctly sets up NetNS", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + podmanTest.RestoreArtifact(nginx) + session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + podmanTest.RestoreArtifact(fedoraMinimal) + session = podmanTest.Podman([]string{"run", "--pod", podID, fedoraMinimal, "curl", "localhost:80"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"run", fedoraMinimal, "curl", "localhost"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman pod correctly sets up PIDNS", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "pid", "--name", "test-pod"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.RunTopContainerInPod("test-ctr", podID) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"top", "test-ctr", "pid"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + PIDs := check.OutputToStringArray() + Expect(len(PIDs)).To(Equal(4)) + + ctrPID, _ := strconv.Atoi(PIDs[1]) + infraPID, _ := strconv.Atoi(PIDs[2]) + Expect(ctrPID).To(BeNumerically("<", infraPID)) + }) + + It("podman pod doesn't share PIDNS if requested to not", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "net", "--name", "test-pod"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.RunTopContainerInPod("test-ctr", podID) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"top", "test-ctr", "pid"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + ctrTop := check.OutputToStringArray() + + check = podmanTest.Podman([]string{"top", podID[:12] + "-infra", "pid"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + infraTop := check.OutputToStringArray() + + ctrPID, _ := strconv.Atoi(ctrTop[1]) + infraPID, _ := strconv.Atoi(infraTop[1]) + Expect(ctrPID).To(Equal(infraPID)) + }) + + It("podman pod container can override pod net NS", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + podmanTest.RestoreArtifact(nginx) + session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + podmanTest.RestoreArtifact(fedoraMinimal) + session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", fedoraMinimal, "curl", "localhost"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + }) + + It("podman pod container can override pod pid NS", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "pid"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "host", "-d", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + outputArray := check.OutputToStringArray() + Expect(len(outputArray)).To(Equal(2)) + + PID1 := outputArray[0] + PID2 := outputArray[1] + Expect(PID1).To(Not(Equal(PID2))) + }) + + It("podman pod container can override pod not sharing pid", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "pod", "-d", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + outputArray := check.OutputToStringArray() + Expect(len(outputArray)).To(Equal(2)) + + PID1 := outputArray[0] + PID2 := outputArray[1] + Expect(PID1).To(Equal(PID2)) + }) + + It("podman pod container can override pod ipc NS", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"run", "--pod", podID, "--ipc", "host", "-d", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.IPC}}"}) + check.WaitWithDefaultTimeout() + Expect(check.ExitCode()).To(Equal(0)) + outputArray := check.OutputToStringArray() + Expect(len(outputArray)).To(Equal(2)) + + PID1 := outputArray[0] + PID2 := outputArray[1] + Expect(PID1).To(Not(Equal(PID2))) + }) + + It("podman pod infra container deletion", func() { + session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + podID := session.OutputToString() + + session = podmanTest.Podman([]string{"ps", "-aq"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + infraID := session.OutputToString() + + session = podmanTest.Podman([]string{"rm", infraID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Not(Equal(0))) + + session = podmanTest.Podman([]string{"pod", "rm", podID}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) +}) diff --git a/test/e2e/pod_pause_container_test.go b/test/e2e/pod_pause_container_test.go deleted file mode 100644 index 09a1c18d0..000000000 --- a/test/e2e/pod_pause_container_test.go +++ /dev/null @@ -1,285 +0,0 @@ -package integration - -import ( - "fmt" - "os" - "strconv" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Podman pod create", func() { - var ( - tempdir string - err error - podmanTest PodmanTest - ) - - BeforeEach(func() { - tempdir, err = CreateTempDirInTempDir() - if err != nil { - os.Exit(1) - } - podmanTest = PodmanCreate(tempdir) - podmanTest.RestoreAllArtifacts() - podmanTest.RestoreArtifact(pause) - }) - - AfterEach(func() { - podmanTest.CleanupPod() - f := CurrentGinkgoTestDescription() - timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds()) - GinkgoWriter.Write([]byte(timedResult)) - }) - - It("podman create pause container", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"}) - check.WaitWithDefaultTimeout() - match, _ := check.GrepString(podID) - Expect(match).To(BeTrue()) - Expect(len(check.OutputToStringArray())).To(Equal(1)) - - check = podmanTest.Podman([]string{"ps", "-qa", "--no-trunc"}) - check.WaitWithDefaultTimeout() - Expect(len(check.OutputToStringArray())).To(Equal(1)) - }) - - It("podman start pause container", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"ps", "-qa", "--no-trunc", "--filter", "status=running"}) - check.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - Expect(len(check.OutputToStringArray())).To(Equal(1)) - }) - - It("podman pause container namespaces", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.RunTopContainerInPod("", podID) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"ps", "-a", "--no-trunc", "--ns", "--format", "{{.IPC}} {{.NET}}"}) - check.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - Expect(len(check.OutputToStringArray())).To(Equal(2)) - Expect(check.OutputToStringArray()[0]).To(Equal(check.OutputToStringArray()[1])) - - }) - - It("podman pod correctly sets up NetNS", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podmanTest.RestoreArtifact(nginx) - session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podmanTest.RestoreArtifact(fedoraMinimal) - session = podmanTest.Podman([]string{"run", "--pod", podID, fedoraMinimal, "curl", "localhost:80"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.Podman([]string{"run", fedoraMinimal, "curl", "localhost"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Not(Equal(0))) - }) - - It("podman pod correctly sets up PIDNS", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "pid", "--name", "test-pod"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.RunTopContainerInPod("test-ctr", podID) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"top", "test-ctr", "pid"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - PIDs := check.OutputToStringArray() - Expect(len(PIDs)).To(Equal(4)) - - ctrPID, _ := strconv.Atoi(PIDs[1]) - pausePID, _ := strconv.Atoi(PIDs[2]) - Expect(ctrPID).To(BeNumerically("<", pausePID)) - }) - - It("podman pod doesn't share PIDNS if requested to not", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "net", "--name", "test-pod"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.RunTopContainerInPod("test-ctr", podID) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"top", "test-ctr", "pid"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - ctrTop := check.OutputToStringArray() - - check = podmanTest.Podman([]string{"top", podID[:12] + "-infra", "pid"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - pauseTop := check.OutputToStringArray() - - ctrPID, _ := strconv.Atoi(ctrTop[1]) - pausePID, _ := strconv.Atoi(pauseTop[1]) - Expect(ctrPID).To(Equal(pausePID)) - }) - - It("podman pod container can override pod net NS", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podmanTest.RestoreArtifact(nginx) - session = podmanTest.Podman([]string{"run", "-d", "--pod", podID, nginx}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podmanTest.RestoreArtifact(fedoraMinimal) - session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", fedoraMinimal, "curl", "localhost"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Not(Equal(0))) - }) - - It("podman pod container can override pod pid NS", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "pid"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "host", "-d", ALPINE, "top"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - outputArray := check.OutputToStringArray() - Expect(len(outputArray)).To(Equal(2)) - - PID1 := outputArray[0] - PID2 := outputArray[1] - Expect(PID1).To(Not(Equal(PID2))) - }) - - It("podman pod container can override pod not sharing pid", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "net"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.Podman([]string{"run", "--pod", podID, "--pid", "pod", "-d", ALPINE, "top"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.PIDNS}}"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - outputArray := check.OutputToStringArray() - Expect(len(outputArray)).To(Equal(2)) - - PID1 := outputArray[0] - PID2 := outputArray[1] - Expect(PID1).To(Equal(PID2)) - }) - - It("podman pod container can override pod ipc NS", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "start", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - session = podmanTest.Podman([]string{"run", "--pod", podID, "--ipc", "host", "-d", ALPINE, "top"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - check := podmanTest.Podman([]string{"ps", "-a", "--ns", "--format", "{{.IPC}}"}) - check.WaitWithDefaultTimeout() - Expect(check.ExitCode()).To(Equal(0)) - outputArray := check.OutputToStringArray() - Expect(len(outputArray)).To(Equal(2)) - - PID1 := outputArray[0] - PID2 := outputArray[1] - Expect(PID1).To(Not(Equal(PID2))) - }) - - It("podman pod pause container deletion", func() { - session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podID := session.OutputToString() - - session = podmanTest.Podman([]string{"ps", "-aq"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - pauseID := session.OutputToString() - - session = podmanTest.Podman([]string{"rm", pauseID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Not(Equal(0))) - - session = podmanTest.Podman([]string{"pod", "rm", podID}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - }) -}) diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index b7f939aa9..c230c8973 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -43,12 +43,10 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on a specific running pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -100,12 +98,10 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on running pods", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -119,12 +115,10 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on all pods", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -138,12 +132,10 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats with json output", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) -- cgit v1.2.3-54-g00ecf