From 6cb25b3d142e16cbfeb68ef98c54c4443ac842d2 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 1 Dec 2021 10:02:35 -0700 Subject: Manual fixes Fix a handful of instances not covered by earlier automated replacements. Found via: ack 'Expect\(len' test/e2e There are still a bunch of BeNumerically(">", ...) that cannot (yet) be handled by HaveLen(). Leave those as they are. Signed-off-by: Ed Santiago --- test/e2e/create_test.go | 2 +- test/e2e/events_test.go | 2 +- test/e2e/images_test.go | 3 +-- test/e2e/pod_ps_test.go | 2 +- test/e2e/ps_test.go | 10 +++++----- test/e2e/rmi_test.go | 4 ++-- test/e2e/system_connection_test.go | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 181628037..9126303cd 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -382,7 +382,7 @@ var _ = Describe("Podman create", func() { inspect := podmanTest.Podman([]string{"inspect", ctrName}) inspect.WaitWithDefaultTimeout() data := inspect.InspectContainerToJSON() - Expect(len(data)).To(Equal(1), "len(InspectContainerToJSON)") + Expect(data).To(HaveLen(1), "len(InspectContainerToJSON)") Expect(data[0].Config.Labels).To(HaveLen(2)) Expect(data[0].Config.Labels).To(HaveKey("TESTKEY1")) Expect(data[0].Config.Labels).To(HaveKey("TESTKEY2")) diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index f0b07caba..39f495460 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -74,7 +74,7 @@ var _ = Describe("Podman events", func() { result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) events := result.OutputToStringArray() - Expect(len(events)).To(Equal(1), "number of events") + Expect(events).To(HaveLen(1), "number of events") Expect(events[0]).To(ContainSubstring(cid), "event log includes CID") Expect(events[0]).To(Not(ContainSubstring(cid2)), "event log does not include second CID") }) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index d854f8723..efa9f399b 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -172,8 +172,7 @@ RUN apk update && apk add strace result := podmanTest.Podman([]string{"images", "-q", "-f", "before=foobar.com/before:latest"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray()) >= 1).To(BeTrue()) - + Expect(len(result.OutputToStringArray())).To(BeNumerically(">=", 1)) }) It("podman images workingdir from image", func() { diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index 7b1c7ed48..4b2a3b66d 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -368,7 +368,7 @@ var _ = Describe("Podman ps", func() { infra := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.InfraId}}"}) infra.WaitWithDefaultTimeout() - Expect(len(infra.OutputToString())).To(BeZero()) + Expect(infra.OutputToString()).To(BeEmpty()) }) It("podman pod ps format with labels", func() { diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 9b7c0eefa..a9f334f5c 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -118,7 +118,7 @@ var _ = Describe("Podman ps", func() { result := podmanTest.Podman([]string{"ps", "-q", "--latest"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).Should(Equal(1)) + Expect(result.OutputToStringArray()).To(HaveLen(1)) }) It("podman ps last flag", func() { @@ -133,7 +133,7 @@ var _ = Describe("Podman ps", func() { result := podmanTest.Podman([]string{"ps", "--last", "2"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).Should(Equal(2)) // 1 container + Expect(result.OutputToStringArray()).Should(HaveLen(2)) // 1 container _, ec, _ := podmanTest.RunLsContainer("test1") Expect(ec).To(Equal(0)) @@ -147,17 +147,17 @@ var _ = Describe("Podman ps", func() { result = podmanTest.Podman([]string{"ps", "--last", "2"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).Should(Equal(3)) // 2 containers + Expect(result.OutputToStringArray()).Should(HaveLen(3)) // 2 containers result = podmanTest.Podman([]string{"ps", "--last", "3"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).Should(Equal(4)) // 3 containers + Expect(result.OutputToStringArray()).Should(HaveLen(4)) // 3 containers result = podmanTest.Podman([]string{"ps", "--last", "100"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) - Expect(len(result.OutputToStringArray())).Should(Equal(5)) // 4 containers (3 running + 1 created) + Expect(result.OutputToStringArray()).Should(HaveLen(5)) // 4 containers (3 running + 1 created) }) It("podman ps no-trunc", func() { diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 70412c825..658155587 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -141,8 +141,8 @@ var _ = Describe("Podman rmi", func() { session = podmanTest.Podman([]string{"images", "--sort", "created", "--format", "{{.Id}}", "--all"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).To(Equal(13), - "Output from 'podman images -q -a':'%s'", session.Out.Contents()) + Expect(session.OutputToStringArray()).To(HaveLen(13), + "Output from 'podman images -q -a'") untaggedImg := session.OutputToStringArray()[1] session = podmanTest.Podman([]string{"rmi", "-f", untaggedImg}) diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go index 76b442ce8..95c2fe5b6 100644 --- a/test/e2e/system_connection_test.go +++ b/test/e2e/system_connection_test.go @@ -236,7 +236,7 @@ var _ = Describe("podman system connection", func() { session := podmanTest.Podman(cmd) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).Should(Equal(1)) + Expect(session.OutputToStringArray()).Should(HaveLen(1)) Expect(session.Err.Contents()).Should(BeEmpty()) }) }) -- cgit v1.2.3-54-g00ecf