summaryrefslogtreecommitdiff
path: root/test/e2e/pod_top_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/pod_top_test.go')
-rw-r--r--test/e2e/pod_top_test.go31
1 files changed, 16 insertions, 15 deletions
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 9d9c138c4..253d4adf5 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -8,6 +8,7 @@ import (
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
)
var _ = Describe("Podman top", func() {
@@ -37,13 +38,13 @@ var _ = Describe("Podman top", func() {
It("podman pod top without pod name or id", func() {
result := podmanTest.Podman([]string{"pod", "top"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on bogus pod", func() {
result := podmanTest.Podman([]string{"pod", "top", "1234"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on non-running pod", func() {
@@ -52,7 +53,7 @@ var _ = Describe("Podman top", func() {
result := podmanTest.Podman([]string{"top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on pod", func() {
@@ -61,14 +62,14 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
if !IsRemote() {
podid = "-l"
}
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
@@ -78,11 +79,11 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "top", podid, "pid", "%C", "args"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
@@ -92,7 +93,7 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
// We need to pass -eo to force executing ps in the Alpine container.
// Alpines stripped down ps(1) is accepting any kind of weird input in
@@ -100,7 +101,7 @@ var _ = Describe("Podman top", func() {
// the wrong input and still print the -ef output instead.
result := podmanTest.Podman([]string{"pod", "top", podid, "-eo", "invalid"})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(125))
+ Expect(result).Should(Exit(125))
})
It("podman pod top on pod with containers in same pid namespace", func() {
@@ -109,16 +110,16 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
cid := session.OutputToString()
session = podmanTest.Podman([]string{"run", "-d", "--pod", podid, "--pid", fmt.Sprintf("container:%s", cid), ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(3))
})
@@ -128,11 +129,11 @@ var _ = Describe("Podman top", func() {
session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
+ Expect(session).Should(Exit(0))
for i := 0; i < 10; i++ {
fmt.Println("Waiting for containers to be running .... ")
@@ -143,7 +144,7 @@ var _ = Describe("Podman top", func() {
}
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
- Expect(result.ExitCode()).To(Equal(0))
+ Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(3))
})
})