diff options
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/libpod_suite_test.go | 15 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 28 | ||||
-rw-r--r-- | test/e2e/pod_inspect_test.go | 8 | ||||
-rw-r--r-- | test/e2e/pod_kill_test.go | 61 | ||||
-rw-r--r-- | test/e2e/pod_pause_container_test.go | 285 | ||||
-rw-r--r-- | test/e2e/pod_pause_test.go | 29 | ||||
-rw-r--r-- | test/e2e/pod_ps_test.go | 98 | ||||
-rw-r--r-- | test/e2e/pod_restart_test.go | 54 | ||||
-rw-r--r-- | test/e2e/pod_rm_test.go | 72 | ||||
-rw-r--r-- | test/e2e/pod_start_test.go | 58 | ||||
-rw-r--r-- | test/e2e/pod_stop_test.go | 58 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 8 |
12 files changed, 493 insertions, 281 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 466f79ae9..019ba9377 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} + CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, pause} RESTORE_IMAGES = []string{ALPINE, BB} ALPINE = "docker.io/library/alpine:latest" BB = "docker.io/library/busybox:latest" @@ -41,6 +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" defaultWaitTimeout = 90 ) @@ -422,6 +423,18 @@ func (p *PodmanTest) RestoreAllArtifacts() error { return nil } +// CreatePod creates a pod with no pause container +// it optionally takes a pod name +func (p *PodmanTest) CreatePod(name string) (*PodmanSession, int, string) { + var podmanArgs = []string{"pod", "create", "--pause=false", "--share", ""} + if name != "" { + podmanArgs = append(podmanArgs, "--name", name) + } + session := p.Podman(podmanArgs) + session.WaitWithDefaultTimeout() + return session, session.ExitCode(), session.OutputToString() +} + //RunTopContainer runs a simple container in the background that // runs top. If the name passed != "", it will have a name func (p *PodmanTest) RunTopContainer(name string) *PodmanSession { diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index a81751c41..4cf685ce2 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -32,23 +32,20 @@ var _ = Describe("Podman pod create", func() { }) It("podman create pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - cid := session.OutputToString() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, podID := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"}) check.WaitWithDefaultTimeout() - match, _ := check.GrepString(cid) + match, _ := check.GrepString(podID) Expect(match).To(BeTrue()) Expect(len(check.OutputToStringArray())).To(Equal(1)) }) It("podman create pod with name", func() { name := "test" - session := podmanTest.Podman([]string{"pod", "create", "--name", name}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod(name) + Expect(ec).To(Equal(0)) check := podmanTest.Podman([]string{"pod", "ps", "--no-trunc"}) check.WaitWithDefaultTimeout() @@ -58,13 +55,11 @@ var _ = Describe("Podman pod create", func() { It("podman create pod with doubled name", func() { name := "test" - session := podmanTest.Podman([]string{"pod", "create", "--name", name}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod(name) + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create", "--name", name}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Not(Equal(1))) + _, ec2, _ := podmanTest.CreatePod(name) + Expect(ec2).To(Not(Equal(0))) check := podmanTest.Podman([]string{"pod", "ps", "-q"}) check.WaitWithDefaultTimeout() @@ -77,9 +72,8 @@ var _ = Describe("Podman pod create", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create", "--name", name}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Not(Equal(1))) + _, ec, _ := podmanTest.CreatePod(name) + Expect(ec).To(Not(Equal(0))) check := podmanTest.Podman([]string{"pod", "ps", "-q"}) check.WaitWithDefaultTimeout() diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index b5c2bd1be..667e59f38 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -38,12 +38,10 @@ var _ = Describe("Podman pod inspect", func() { }) It("podman inspect a 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)) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 427fb63b3..b29fe1e17 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -38,12 +38,10 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id", 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)) @@ -58,12 +56,10 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id with TERM", 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)) @@ -74,12 +70,10 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by name", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "test1"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("test1") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -90,12 +84,10 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id with a bogus signal", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "test1"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("test1") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -106,19 +98,15 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill latest pod", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "test1"}) - 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)) - session = podmanTest.Podman([]string{"pod", "create", "--name", "test2"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid2 := session.OutputToString() + _, ec, podid2 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() @@ -135,12 +123,10 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill all", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "test1"}) - 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)) @@ -148,10 +134,8 @@ var _ = Describe("Podman pod kill", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create", "--name", "test2"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid2 := session.OutputToString() + _, ec, podid2 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() @@ -159,6 +143,7 @@ var _ = Describe("Podman pod kill", func() { result := podmanTest.Podman([]string{"pod", "kill", "-a"}) result.WaitWithDefaultTimeout() + fmt.Println(result.OutputToString(), result.ErrorToString()) Expect(result.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) diff --git a/test/e2e/pod_pause_container_test.go b/test/e2e/pod_pause_container_test.go new file mode 100644 index 000000000..09a1c18d0 --- /dev/null +++ b/test/e2e/pod_pause_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(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_pause_test.go b/test/e2e/pod_pause_test.go index 6a5afe73b..384cbfcb7 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -46,10 +46,8 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a created pod by id", 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)) result := podmanTest.Podman([]string{"pod", "pause", podid}) result.WaitWithDefaultTimeout() @@ -57,12 +55,10 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a running pod by id", 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)) @@ -80,12 +76,10 @@ var _ = Describe("Podman pod pause", func() { }) It("podman unpause a running pod by id", 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)) @@ -97,11 +91,10 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a running pod by name", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "test1"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod("test1") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "test1") + session := podmanTest.RunTopContainerInPod("", "test1") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index 4e2995917..b48cb9578 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -39,12 +39,10 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps default", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid := session.OutputToString() - session = podmanTest.RunTopContainerInPod("", podid) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -55,12 +53,10 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps quiet flag", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid := session.OutputToString() - _, ec, _ := podmanTest.RunLsContainerInPod("", podid) + _, ec, _ = podmanTest.RunLsContainerInPod("", podid) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "ps", "-q"}) @@ -71,14 +67,12 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps no-trunc", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podid := session.OutputToString() - _, ec, _ := podmanTest.RunLsContainerInPod("", podid) + _, ec, podid := podmanTest.CreatePod("") Expect(ec).To(Equal(0)) + _, ec2, _ := podmanTest.RunLsContainerInPod("", podid) + Expect(ec2).To(Equal(0)) + result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) @@ -87,17 +81,11 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps latest", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - - podid1 := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, podid1 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid2 := session.OutputToString() + _, ec2, podid2 := podmanTest.CreatePod("") + Expect(ec2).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--latest"}) result.WaitWithDefaultTimeout() @@ -106,11 +94,10 @@ var _ = Describe("Podman ps", func() { Expect(result.OutputToString()).To(Not(ContainSubstring(podid1))) }) It("podman pod ps id filter flag", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - result := podmanTest.Podman([]string{"pod", "ps", "--filter", fmt.Sprintf("id=%s", session.OutputToString())}) + result := podmanTest.Podman([]string{"pod", "ps", "--filter", fmt.Sprintf("id=%s", podid)}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) }) @@ -123,19 +110,16 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps --sort by name", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec2, _ := podmanTest.CreatePod("") + Expect(ec2).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec3, _ := podmanTest.CreatePod("") + Expect(ec3).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "ps", "--sort=name", "--format", "{{.Name}}"}) + session := podmanTest.Podman([]string{"pod", "ps", "--sort=name", "--format", "{{.Name}}"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -146,16 +130,14 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps --ctr-names", 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("test1", podid) + session := podmanTest.RunTopContainerInPod("test1", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ := podmanTest.RunLsContainerInPod("test2", podid) + _, ec, _ = podmanTest.RunLsContainerInPod("test2", podid) Expect(ec).To(Equal(0)) session = podmanTest.Podman([]string{"pod", "ps", "--format={{.ContainerInfo}}", "--ctr-names"}) @@ -166,22 +148,18 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps filter ctr attributes", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid1 := session.OutputToString() + _, ec, podid1 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("test1", podid1) + session := podmanTest.RunTopContainerInPod("test1", podid1) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid2 := session.OutputToString() + _, ec2, podid2 := podmanTest.CreatePod("") + Expect(ec2).To(Equal(0)) - _, ec, cid := podmanTest.RunLsContainerInPod("test2", podid2) - Expect(ec).To(Equal(0)) + _, ec3, cid := podmanTest.RunLsContainerInPod("test2", podid2) + Expect(ec3).To(Equal(0)) session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-names=test1"}) session.WaitWithDefaultTimeout() @@ -195,10 +173,8 @@ var _ = Describe("Podman ps", func() { Expect(session.OutputToString()).To(ContainSubstring(podid2)) Expect(session.OutputToString()).To(Not(ContainSubstring(podid1))) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - podid3 := session.OutputToString() + _, ec3, podid3 := podmanTest.CreatePod("") + Expect(ec3).To(Equal(0)) session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-number=1"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index 86132c04f..e486f8791 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -38,22 +38,19 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart single empty pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - cid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "restart", cid}) + session := podmanTest.Podman([]string{"pod", "restart", podid}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) }) It("podman pod restart single pod by name", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("test1", "foobar99") + session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -70,15 +67,15 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart multiple pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("test1", "foobar99") + session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") session.WaitWithDefaultTimeout() @@ -108,15 +105,15 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart all pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("test1", "foobar99") + session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") session.WaitWithDefaultTimeout() @@ -136,15 +133,15 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart latest pod", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("test1", "foobar99") + session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") session.WaitWithDefaultTimeout() @@ -164,15 +161,14 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart multiple pods with bogus", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - cid1 := session.OutputToString() + _, ec, podid1 := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "restart", cid1, "doesnotexist"}) + session = podmanTest.Podman([]string{"pod", "restart", podid1, "doesnotexist"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) }) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 1ce0d18c7..09002e954 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -32,9 +32,8 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm empty pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "rm", podid}) result.WaitWithDefaultTimeout() @@ -42,13 +41,11 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm latest pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - podid2 := session.OutputToString() + _, ec2, podid2 := podmanTest.CreatePod("") + Expect(ec2).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "rm", "--latest"}) result.WaitWithDefaultTimeout() @@ -62,14 +59,11 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm doesn't remove a pod with a container", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - - podid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", podid, ALPINE, "ls"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec2, _ := podmanTest.RunLsContainerInPod("", podid) + Expect(ec2).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "rm", podid}) result.WaitWithDefaultTimeout() @@ -81,12 +75,10 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -f does remove a running container", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid := session.OutputToString() - - session = podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top"}) + session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -100,15 +92,13 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -a doesn't remove a running container", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() + _, ec, podid1 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid1 := session.OutputToString() + _, ec, _ = podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - - session = podmanTest.Podman([]string{"run", "-d", "--pod", podid1, ALPINE, "top"}) + session := podmanTest.RunTopContainerInPod("", podid1) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -127,20 +117,16 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -fa removes everything", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - - podid1 := session.OutputToString() - - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() + _, ec, podid1 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - podid2 := session.OutputToString() + _, ec, podid2 := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"run", "-d", "--pod", podid1, ALPINE, "top"}) + session := podmanTest.RunTopContainerInPod("", podid1) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -148,12 +134,12 @@ var _ = Describe("Podman pod rm", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"run", "-d", "--pod", podid2, ALPINE, "ls"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ = podmanTest.RunLsContainerInPod("", podid2) + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"run", "-d", "--pod", podid2, ALPINE, "top"}) + session = podmanTest.RunTopContainerInPod("", podid2) session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "rm", "-fa"}) result.WaitWithDefaultTimeout() diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index 17296c4b3..9d2ea9b26 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -38,22 +38,19 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start single empty pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - cid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "start", cid}) + session := podmanTest.Podman([]string{"pod", "start", podid}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) }) It("podman pod start single pod by name", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -63,38 +60,36 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start multiple pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - cid1 := session.OutputToString() + _, ec, podid1 := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) + session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() - cid2 := session2.OutputToString() + _, ec2, podid2 := podmanTest.CreatePod("foobar100") + Expect(ec2).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "start", cid1, cid2}) + session = podmanTest.Podman([]string{"pod", "start", podid1, podid2}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) }) It("podman pod start all pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) + session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) session.WaitWithDefaultTimeout() @@ -107,15 +102,15 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start latest pod", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) + session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) session.WaitWithDefaultTimeout() @@ -128,15 +123,14 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start multiple pods with bogus", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - cid1 := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) + session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "start", cid1, "doesnotexist"}) + session = podmanTest.Podman([]string{"pod", "start", podid, "doesnotexist"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index 0eb41b696..32f8559ad 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -38,22 +38,19 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop single empty pod", func() { - session := podmanTest.Podman([]string{"pod", "create"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - cid := session.OutputToString() + _, ec, podid := podmanTest.CreatePod("") + Expect(ec).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", cid}) + session := podmanTest.Podman([]string{"pod", "stop", podid}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) }) It("podman pod stop single pod by name", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -64,38 +61,36 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop multiple pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - cid1 := session.OutputToString() + _, ec, podid1 := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() - cid2 := session2.OutputToString() + _, ec2, podid2 := podmanTest.CreatePod("foobar100") + Expect(ec2).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", cid1, cid2}) + session = podmanTest.Podman([]string{"pod", "stop", podid1, podid2}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) It("podman pod stop all pods", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") session.WaitWithDefaultTimeout() @@ -108,15 +103,15 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop latest pod", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() + _, ec, _ := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session2 := podmanTest.Podman([]string{"pod", "create", "--name", "foobar100"}) - session2.WaitWithDefaultTimeout() + _, ec, _ = podmanTest.CreatePod("foobar100") + Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") session.WaitWithDefaultTimeout() @@ -129,15 +124,14 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop multiple pods with bogus", func() { - session := podmanTest.Podman([]string{"pod", "create", "--name", "foobar99"}) - session.WaitWithDefaultTimeout() - cid1 := session.OutputToString() + _, ec, podid1 := podmanTest.CreatePod("foobar99") + Expect(ec).To(Equal(0)) - session = podmanTest.RunTopContainerInPod("", "foobar99") + session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", cid1, "doesnotexist"}) + session = podmanTest.Podman([]string{"pod", "stop", podid1, "doesnotexist"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 5dfb385a8..f5d79193b 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -248,12 +248,10 @@ var _ = Describe("Podman ps", func() { }) It("podman --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)) |