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 <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2021-12-01 10:02:35 -07:00
parent eb1212bed9
commit 6cb25b3d14
7 changed files with 12 additions and 13 deletions

View File

@ -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"))

View File

@ -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")
})

View File

@ -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() {

View File

@ -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() {

View File

@ -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() {

View File

@ -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})

View File

@ -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())
})
})