From 2fcb39586cd1a1b07afd561c1bbd7ba166c44879 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 23 Nov 2021 06:49:49 -0700 Subject: Remove StringInSlice(), part 1 via: sed -i -e 's/Expect(StringInSlice(\(.*\), \(.*\))).To(BeTrue())/Expect(\2)\.To(ContainElement(\1))/' test/e2e/*_test.go Signed-off-by: Ed Santiago --- test/e2e/commit_test.go | 6 +++--- test/e2e/generate_kube_test.go | 16 ++++++++-------- test/e2e/tag_test.go | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index d40faf54b..20e1360de 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -47,7 +47,7 @@ var _ = Describe("Podman commit", func() { check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"}) check.WaitWithDefaultTimeout() data := check.InspectImageJSON() - Expect(StringInSlice("foobar.com/test1-image:latest", data[0].RepoTags)).To(BeTrue()) + Expect(data[0].RepoTags).To(ContainElement("foobar.com/test1-image:latest")) }) It("podman commit single letter container", func() { @@ -62,7 +62,7 @@ var _ = Describe("Podman commit", func() { check := podmanTest.Podman([]string{"inspect", "localhost/a:latest"}) check.WaitWithDefaultTimeout() data := check.InspectImageJSON() - Expect(StringInSlice("localhost/a:latest", data[0].RepoTags)).To(BeTrue()) + Expect(data[0].RepoTags).To(ContainElement("localhost/a:latest")) }) It("podman container commit container", func() { @@ -77,7 +77,7 @@ var _ = Describe("Podman commit", func() { check := podmanTest.Podman([]string{"image", "inspect", "foobar.com/test1-image:latest"}) check.WaitWithDefaultTimeout() data := check.InspectImageJSON() - Expect(StringInSlice("foobar.com/test1-image:latest", data[0].RepoTags)).To(BeTrue()) + Expect(data[0].RepoTags).To(ContainElement("foobar.com/test1-image:latest")) }) It("podman commit container with message", func() { diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index d95555068..a148025e5 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -775,8 +775,8 @@ var _ = Describe("Podman generate kube", func() { err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) - Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) - Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) + Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8")) + Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com")) Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0)) Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color")) Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue")) @@ -799,10 +799,10 @@ var _ = Describe("Podman generate kube", func() { err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) - Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) - Expect(StringInSlice("8.7.7.7", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) - Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) - Expect(StringInSlice("homer.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) + Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8")) + Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.7.7.7")) + Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com")) + Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("homer.com")) }) It("podman generate kube on a pod with dns options", func() { @@ -818,8 +818,8 @@ var _ = Describe("Podman generate kube", func() { err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) - Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) - Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) + Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8")) + Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com")) Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0)) Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color")) Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue")) diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go index b835d3776..743f58ea2 100644 --- a/test/e2e/tag_test.go +++ b/test/e2e/tag_test.go @@ -42,8 +42,8 @@ var _ = Describe("Podman tag", func() { results.WaitWithDefaultTimeout() Expect(results).Should(Exit(0)) inspectData := results.InspectImageJSON() - Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) + Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest")) + Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:latest")) }) It("podman tag shortname", func() { @@ -55,8 +55,8 @@ var _ = Describe("Podman tag", func() { results.WaitWithDefaultTimeout() Expect(results).Should(Exit(0)) inspectData := results.InspectImageJSON() - Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) + Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest")) + Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:latest")) }) It("podman tag shortname:tag", func() { @@ -68,8 +68,8 @@ var _ = Describe("Podman tag", func() { results.WaitWithDefaultTimeout() Expect(results).Should(Exit(0)) inspectData := results.InspectImageJSON() - Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("localhost/foobar:new", inspectData[0].RepoTags)).To(BeTrue()) + Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest")) + Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:new")) }) It("podman tag shortname image no tag", func() { -- cgit v1.2.3-54-g00ecf