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 <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2021-11-23 06:49:49 -07:00
parent cd59721de1
commit 2fcb39586c
3 changed files with 17 additions and 17 deletions

View File

@ -47,7 +47,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"}) check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout() check.WaitWithDefaultTimeout()
data := check.InspectImageJSON() 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() { 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 := podmanTest.Podman([]string{"inspect", "localhost/a:latest"})
check.WaitWithDefaultTimeout() check.WaitWithDefaultTimeout()
data := check.InspectImageJSON() 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() { 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 := podmanTest.Podman([]string{"image", "inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout() check.WaitWithDefaultTimeout()
data := check.InspectImageJSON() 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() { It("podman commit container with message", func() {

View File

@ -775,8 +775,8 @@ var _ = Describe("Podman generate kube", func() {
err := yaml.Unmarshal(kube.Out.Contents(), pod) err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0)) 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].Name).To(Equal("color"))
Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue")) 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) err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(StringInSlice("8.7.7.7", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.7.7.7"))
Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(StringInSlice("homer.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("homer.com"))
}) })
It("podman generate kube on a pod with dns options", func() { 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) err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
Expect(StringInSlice("8.8.8.8", pod.Spec.DNSConfig.Nameservers)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Nameservers).To(ContainElement("8.8.8.8"))
Expect(StringInSlice("foobar.com", pod.Spec.DNSConfig.Searches)).To(BeTrue()) Expect(pod.Spec.DNSConfig.Searches).To(ContainElement("foobar.com"))
Expect(len(pod.Spec.DNSConfig.Options)).To(BeNumerically(">", 0)) 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].Name).To(Equal("color"))
Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue")) Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue"))

View File

@ -42,8 +42,8 @@ var _ = Describe("Podman tag", func() {
results.WaitWithDefaultTimeout() results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(0)) Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON() inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest"))
Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:latest"))
}) })
It("podman tag shortname", func() { It("podman tag shortname", func() {
@ -55,8 +55,8 @@ var _ = Describe("Podman tag", func() {
results.WaitWithDefaultTimeout() results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(0)) Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON() inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest"))
Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:latest"))
}) })
It("podman tag shortname:tag", func() { It("podman tag shortname:tag", func() {
@ -68,8 +68,8 @@ var _ = Describe("Podman tag", func() {
results.WaitWithDefaultTimeout() results.WaitWithDefaultTimeout()
Expect(results).Should(Exit(0)) Expect(results).Should(Exit(0))
inspectData := results.InspectImageJSON() inspectData := results.InspectImageJSON()
Expect(StringInSlice("quay.io/libpod/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("quay.io/libpod/alpine:latest"))
Expect(StringInSlice("localhost/foobar:new", inspectData[0].RepoTags)).To(BeTrue()) Expect(inspectData[0].RepoTags).To(ContainElement("localhost/foobar:new"))
}) })
It("podman tag shortname image no tag", func() { It("podman tag shortname image no tag", func() {