Use BeEmpty() instead of len(x).To(Equal(0))

sed -i -e 's/Expect(len(\(.*\)))\.To(Equal(0))/Expect(\1).To(BeEmpty())/' test/e2e/*.go

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2021-12-01 08:46:12 -07:00
parent c676495468
commit 7c6123f8e1
19 changed files with 31 additions and 31 deletions

View File

@ -62,7 +62,7 @@ func checkDataVolumeContainer(pTest *PodmanTestIntegration, image, cont, dest, d
Expect(err).To(BeNil())
if data == "" {
Expect(len(files)).To(Equal(0))
Expect(files).To(BeEmpty())
} else {
Expect(len(files)).To(Equal(1))
Expect(files[0].Name()).To(Equal(data))

View File

@ -86,7 +86,7 @@ var _ = Describe("Podman events", func() {
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod", "--filter", fmt.Sprintf("container=%s", cid)})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(result.OutputToStringArray()).To(BeEmpty())
})
It("podman events with a type", func() {

View File

@ -862,7 +862,7 @@ var _ = Describe("Podman generate kube", func() {
containers := pod.Spec.Containers
Expect(len(containers)).To(Equal(1))
Expect(len(containers[0].Command)).To(Equal(0))
Expect(containers[0].Command).To(BeEmpty())
cmd := []string{"echo", "hi"}
session = podmanTest.Podman(append([]string{"create", "--name", "test1", ALPINE}, cmd...))

View File

@ -161,7 +161,7 @@ var _ = Describe("Podman images", func() {
retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"})
retnone.WaitWithDefaultTimeout()
Expect(retnone).Should(Exit(0))
Expect(len(retnone.OutputToStringArray())).To(Equal(0))
Expect(retnone.OutputToStringArray()).To(BeEmpty())
})
It("podman images filter before image", func() {
@ -441,7 +441,7 @@ RUN > file2
//check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(result.OutputToStringArray()).To(BeEmpty())
})
@ -462,7 +462,7 @@ RUN > file2
//check if really abc is removed
result = podmanTest.Podman([]string{"image", "list", "--filter", "label=abc"})
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(result.OutputToStringArray()).To(BeEmpty())
})

View File

@ -245,7 +245,7 @@ var _ = Describe("Podman inspect", func() {
baseInspect.WaitWithDefaultTimeout()
Expect(baseInspect).To(ExitWithError())
emptyJSON := baseInspect.InspectContainerToJSON()
Expect(len(emptyJSON)).To(Equal(0))
Expect(emptyJSON).To(BeEmpty())
})
It("podman inspect one container with not exist returns 1-length valid array", func() {

View File

@ -97,7 +97,7 @@ var _ = Describe("Podman logs", func() {
results := podmanTest.Podman([]string{"logs", "--tail", "0", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
Expect(len(results.OutputToStringArray())).To(Equal(0))
Expect(results.OutputToStringArray()).To(BeEmpty())
})
It("tail 99 lines: "+log, func() {

View File

@ -291,7 +291,7 @@ var _ = Describe("Podman pause", func() {
running = podmanTest.Podman([]string{"ps", "-q"})
running.WaitWithDefaultTimeout()
Expect(running).Should(Exit(0))
Expect(len(running.OutputToStringArray())).To(Equal(0))
Expect(running.OutputToStringArray()).To(BeEmpty())
unpause := podmanTest.Podman([]string{"unpause", "--all"})
unpause.WaitWithDefaultTimeout()

View File

@ -2780,7 +2780,7 @@ invalid kube kind
checkls := podmanTest.Podman([]string{"pod", "ps", "--format", "'{{.ID}}'"})
checkls.WaitWithDefaultTimeout()
Expect(checkls).Should(Exit(0))
Expect(len(checkls.OutputToStringArray())).To(Equal(0))
Expect(checkls.OutputToStringArray()).To(BeEmpty())
})
It("podman play kube teardown pod does not exist", func() {

View File

@ -86,7 +86,7 @@ var _ = Describe("Podman pod create", func() {
check := podmanTest.Podman([]string{"pod", "ps", "-q"})
check.WaitWithDefaultTimeout()
Expect(len(check.OutputToStringArray())).To(Equal(0))
Expect(check.OutputToStringArray()).To(BeEmpty())
})
It("podman create pod without network portbindings", func() {

View File

@ -72,6 +72,6 @@ var _ = Describe("Podman pod prune", func() {
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(result.OutputToStringArray()).To(BeEmpty())
})
})

View File

@ -96,7 +96,7 @@ var _ = Describe("Podman pod rm", func() {
result = podmanTest.Podman([]string{"ps", "-qa"})
result.WaitWithDefaultTimeout()
Expect(len(result.OutputToStringArray())).To(Equal(0))
Expect(result.OutputToStringArray()).To(BeEmpty())
})
It("podman pod rm -f does remove a running container", func() {

View File

@ -105,7 +105,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
// Let's be extra sure that the same number of images is
// reported.
@ -157,7 +157,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"image", "prune", "-f"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
// Now the image will be untagged, and its parent images will
// be removed recursively.
@ -354,7 +354,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
// One Pod should not be pruned as it was running
Expect(podmanTest.NumberOfPods()).To(Equal(1))

View File

@ -458,7 +458,7 @@ var _ = Describe("Podman pull", func() {
data := setup.InspectImageJSON() // returns []inspect.ImageData
Expect(len(data)).To(Equal(1))
Expect(len(data[0].RepoTags)).To(Equal(0))
Expect(data[0].RepoTags).To(BeEmpty())
}
tag := func(image, tag string) {

View File

@ -68,7 +68,7 @@ var _ = Describe("Podman run", func() {
session = podmanTest.Podman([]string{"run", "--rm", "--env", "FOO", ALPINE, "printenv", "FOO"})
session.WaitWithDefaultTimeout()
Expect(len(session.OutputToString())).To(Equal(0))
Expect(session.OutputToString()).To(BeEmpty())
Expect(session).Should(Exit(1))
session = podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv"})

View File

@ -74,11 +74,11 @@ var _ = Describe("podman system reset", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
session = podmanTest.Podman([]string{"container", "ls", "-q"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
})

View File

@ -98,7 +98,7 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=bar"})
session.WaitWithDefaultTimeout()
@ -109,7 +109,7 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "label=foo=baz"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman ls volume with --filter until flag", func() {
@ -125,7 +125,7 @@ var _ = Describe("Podman volume ls", func() {
session = podmanTest.Podman([]string{"volume", "ls", "--filter", "until=50000"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume ls with --filter dangling", func() {

View File

@ -82,7 +82,7 @@ var _ = Describe("Podman volume plugins", func() {
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
Expect(ls2).Should(Exit(0))
Expect(len(ls2.OutputToStringArray())).To(Equal(0))
Expect(ls2.OutputToStringArray()).To(BeEmpty())
})
It("volume inspect with running plugin succeeds", func() {
@ -146,7 +146,7 @@ var _ = Describe("Podman volume plugins", func() {
ls2 := podmanTest.Podman([]string{"volume", "ls", "-q"})
ls2.WaitWithDefaultTimeout()
Expect(ls2).Should(Exit(0))
Expect(len(ls2.OutputToStringArray())).To(Equal(0))
Expect(ls2.OutputToStringArray()).To(BeEmpty())
})
It("use plugin in containers", func() {

View File

@ -89,7 +89,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
@ -179,7 +179,7 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})

View File

@ -45,7 +45,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm with --force flag", func() {
@ -66,7 +66,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
@ -93,7 +93,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm by partial name", func() {
@ -108,7 +108,7 @@ var _ = Describe("Podman volume rm", func() {
session = podmanTest.Podman([]string{"volume", "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(Equal(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
})
It("podman volume rm by nonunique partial name", func() {