summaryrefslogtreecommitdiff
path: root/test/e2e/ps_test.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-12-01 08:49:55 -0700
committerEd Santiago <santiago@redhat.com>2021-12-02 07:54:53 -0700
commitc0a8814fb4d55a950ebf2b2c48731ac939318d7e (patch)
treede7c1c548a5b9486333fe6417bbb659d28dbec33 /test/e2e/ps_test.go
parent92f9e117670bb060307aadbd6bdeee303923091c (diff)
downloadpodman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.gz
podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.tar.bz2
podman-c0a8814fb4d55a950ebf2b2c48731ac939318d7e.zip
Use HaveLen(x) instead of Expect(len(y)).To(Equal(x))
sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(\(.*\)))/Expect(\1).To(HaveLen(\2))/' test/e2e/*.go Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/ps_test.go')
-rw-r--r--test/e2e/ps_test.go46
1 files changed, 23 insertions, 23 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 3334250db..9b7c0eefa 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -357,7 +357,7 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(fullCid))
})
@@ -580,14 +580,14 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(2))
+ Expect(output).To(HaveLen(2))
result = podmanTest.Podman([]string{"ps", "-aq", "--no-trunc", "--filter", "name=test1$"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
output = result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(fullCid))
})
@@ -602,7 +602,7 @@ var _ = Describe("Podman ps", func() {
Expect(result).Should(Exit(0))
output := result.OutputToStringArray()
- Expect(len(output)).To(Equal(1))
+ Expect(output).To(HaveLen(1))
Expect(output[0]).To(Equal(ctrName))
})
@@ -669,7 +669,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(5))
+ Expect(session.OutputToStringArray()).To(HaveLen(5))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
@@ -678,7 +678,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test1", "--filter", "name=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
@@ -686,19 +686,19 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "id=" + cid1[:40], "--filter", "id=" + cid1 + "$"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--filter", "status=created"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
session = podmanTest.Podman([]string{"ps", "--filter", "status=created", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
@@ -706,63 +706,63 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--filter", "label=foo=1", "--filter", "status=exited"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=non=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(1))
+ Expect(session.OutputToStringArray()).To(HaveLen(1))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=bar=2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1", "--filter", "exited=0"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test2"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=volume1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=/:/test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "before=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToString()).To(ContainSubstring("test1"))
session = podmanTest.Podman([]string{"ps", "--all", "--filter", "since=test2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(3))
+ Expect(session.OutputToStringArray()).To(HaveLen(3))
Expect(session.OutputToString()).To(ContainSubstring("test3"))
Expect(session.OutputToString()).To(ContainSubstring("test4"))
})
@@ -790,28 +790,28 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by full pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by partial pod id
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=" + pod1.OutputToString()[0:12]})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(2))
+ Expect(session.OutputToStringArray()).To(HaveLen(2))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
// filter by multiple pods is inclusive
session = podmanTest.Podman([]string{"ps", "-q", "--no-trunc", "--filter", "pod=pod1", "--filter", "pod=pod2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(len(session.OutputToStringArray())).To(Equal(4))
+ Expect(session.OutputToStringArray()).To(HaveLen(4))
Expect(session.OutputToStringArray()).To(ContainElement(con1.OutputToString()))
Expect(session.OutputToStringArray()).To(ContainElement(con2.OutputToString()))