From 7c6123f8e131d1083af065cd4620dd5c29b66048 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 1 Dec 2021 08:46:12 -0700 Subject: 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 --- test/e2e/container_create_volume_test.go | 2 +- test/e2e/events_test.go | 2 +- test/e2e/generate_kube_test.go | 2 +- test/e2e/images_test.go | 6 +++--- test/e2e/inspect_test.go | 2 +- test/e2e/logs_test.go | 2 +- test/e2e/pause_test.go | 2 +- test/e2e/play_kube_test.go | 2 +- test/e2e/pod_create_test.go | 2 +- test/e2e/pod_prune_test.go | 2 +- test/e2e/pod_rm_test.go | 2 +- test/e2e/prune_test.go | 6 +++--- test/e2e/pull_test.go | 2 +- test/e2e/run_env_test.go | 2 +- test/e2e/system_reset_test.go | 4 ++-- test/e2e/volume_ls_test.go | 6 +++--- test/e2e/volume_plugin_test.go | 4 ++-- test/e2e/volume_prune_test.go | 4 ++-- test/e2e/volume_rm_test.go | 8 ++++---- 19 files changed, 31 insertions(+), 31 deletions(-) diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go index 0dac96a5e..572885fd6 100644 --- a/test/e2e/container_create_volume_test.go +++ b/test/e2e/container_create_volume_test.go @@ -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)) diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 2b9b0f575..f0b07caba 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -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() { diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 735334eec..2214f2a95 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -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...)) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 9cc04e6b0..e4d63fc27 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -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()) }) diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index 0f0237adc..e75dfef68 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -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() { diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 2558af0eb..14b96f70b 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -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() { diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index 99488a507..a8fcfb071 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -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() diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index bcab92b97..c1fde7ebc 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -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() { diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 186688b93..417a48be2 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -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() { diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index 6273fcec3..b67fab904 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -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()) }) }) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index d9b0761fa..636503a0c 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -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() { diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 6b0081171..623db65b1 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -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)) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index b2474b223..1f24301d1 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -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) { diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go index 5a62db809..f27f5eda7 100644 --- a/test/e2e/run_env_test.go +++ b/test/e2e/run_env_test.go @@ -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"}) diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go index 93ab166cd..42c6e618f 100644 --- a/test/e2e/system_reset_test.go +++ b/test/e2e/system_reset_test.go @@ -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()) }) }) diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go index c1214366b..8a0dce64d 100644 --- a/test/e2e/volume_ls_test.go +++ b/test/e2e/volume_ls_test.go @@ -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() { diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go index cdf635b14..857cd0873 100644 --- a/test/e2e/volume_plugin_test.go +++ b/test/e2e/volume_plugin_test.go @@ -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() { diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go index 364ca0ab7..4e811de55 100644 --- a/test/e2e/volume_prune_test.go +++ b/test/e2e/volume_prune_test.go @@ -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() }) diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go index a05c1b593..68d94963a 100644 --- a/test/e2e/volume_rm_test.go +++ b/test/e2e/volume_rm_test.go @@ -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() { -- cgit v1.2.3-54-g00ecf