summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-11-30 09:48:31 -0700
committerEd Santiago <santiago@redhat.com>2021-11-30 09:53:15 -0700
commitf7cbb1d8451ae8b9b338aa416e443517a326edba (patch)
treecc92721ee136f5ec472cc457cb6de542fade2110 /test/e2e
parent12787963b04f91a7fec9aa0d6915666e43aeb269 (diff)
downloadpodman-f7cbb1d8451ae8b9b338aa416e443517a326edba.tar.gz
podman-f7cbb1d8451ae8b9b338aa416e443517a326edba.tar.bz2
podman-f7cbb1d8451ae8b9b338aa416e443517a326edba.zip
Convert strings.Contains() to Expect(ContainSubstring)
...done manually, not via sed, because some of the inner expressions include nested commas. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/pod_create_test.go20
-rw-r--r--test/e2e/run_networking_test.go6
-rw-r--r--test/e2e/run_test.go2
-rw-r--r--test/e2e/run_userns_test.go2
-rw-r--r--test/e2e/run_volume_test.go12
-rw-r--r--test/e2e/systemd_test.go2
-rw-r--r--test/e2e/volume_inspect_test.go2
7 files changed, 23 insertions, 23 deletions
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index a3dde3650..186688b93 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -173,7 +173,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), "12.34.56.78 test.example.com")).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring("12.34.56.78 test.example.com"))
})
It("podman create pod with --add-host and no infra should fail", func() {
@@ -193,7 +193,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("nameserver %s", server))).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring("nameserver %s", server))
})
It("podman create pod with DNS server set and no infra should fail", func() {
@@ -214,7 +214,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("options %s", option))).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("options %s", option)))
})
It("podman create pod with DNS option set and no infra should fail", func() {
@@ -235,7 +235,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), fmt.Sprintf("search %s", search))).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("search %s", search)))
})
It("podman create pod with DNS search domain set and no infra should fail", func() {
@@ -259,7 +259,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), ip)).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring(ip))
}
})
@@ -302,7 +302,7 @@ var _ = Describe("Podman pod create", func() {
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0))
- Expect(strings.Contains(podResolvConf.OutputToString(), mac)).To(BeTrue())
+ Expect(podResolvConf.OutputToString()).To(ContainSubstring(mac))
}
})
@@ -474,7 +474,7 @@ entrypoint ["/fromimage"]
status1 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status1.WaitWithDefaultTimeout()
Expect(status1).Should(Exit(0))
- Expect(strings.Contains(status1.OutputToString(), "Created")).To(BeTrue())
+ Expect(status1.OutputToString()).To(ContainSubstring("Created"))
ctr1 := podmanTest.Podman([]string{"run", "--pod", podName, "-d", ALPINE, "top"})
ctr1.WaitWithDefaultTimeout()
@@ -483,7 +483,7 @@ entrypoint ["/fromimage"]
status2 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status2.WaitWithDefaultTimeout()
Expect(status2).Should(Exit(0))
- Expect(strings.Contains(status2.OutputToString(), "Running")).To(BeTrue())
+ Expect(status2.OutputToString()).To(ContainSubstring("Running"))
ctr2 := podmanTest.Podman([]string{"create", "--pod", podName, ALPINE, "top"})
ctr2.WaitWithDefaultTimeout()
@@ -492,7 +492,7 @@ entrypoint ["/fromimage"]
status3 := podmanTest.Podman([]string{"pod", "inspect", "--format", "{{ .State }}", podName})
status3.WaitWithDefaultTimeout()
Expect(status3).Should(Exit(0))
- Expect(strings.Contains(status3.OutputToString(), "Degraded")).To(BeTrue())
+ Expect(status3.OutputToString()).To(ContainSubstring("Degraded"))
})
It("podman create with unsupported network options", func() {
@@ -725,7 +725,7 @@ ENTRYPOINT ["sleep","99999"]
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
l := session.OutputToString()
- Expect(strings.Contains(l, "1024")).To(BeTrue())
+ Expect(l).To(ContainSubstring("1024"))
m[l] = l
}
// check for no duplicates
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 5898cc38d..c0840c83b 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -758,7 +758,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
- Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
+ Expect(run.OutputToString()).To(ContainSubstring(hostname))
})
It("podman run with --net=none sets hostname", func() {
@@ -766,7 +766,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
- Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
+ Expect(run.OutputToString()).To(ContainSubstring(hostname))
})
It("podman run with --net=none adds hostname to /etc/hosts", func() {
@@ -774,7 +774,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
- Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
+ Expect(run.OutputToString()).To(ContainSubstring(hostname))
})
It("podman run with pod does not add extra 127 entry to /etc/hosts", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 7b08c48c3..6c47e9179 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1518,7 +1518,7 @@ USER mail`, BB)
session := podmanTest.Podman([]string{"run", "-t", "-i", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(strings.Contains(session.OutputToString(), groupName)).To(BeTrue())
+ Expect(session.OutputToString()).To(ContainSubstring(groupName))
})
It("podman run --tz", func() {
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 9b981ef72..50f8087f1 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -153,7 +153,7 @@ var _ = Describe("Podman UserNS support", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
l := session.OutputToString()
- Expect(strings.Contains(l, "1024")).To(BeTrue())
+ Expect(l).To(ContainSubstring("1024"))
m[l] = l
}
// check for no duplicates
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 196c5778a..10c191bd9 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -287,7 +287,7 @@ var _ = Describe("Podman run with volumes", func() {
os.Stderr.Sync()
mountOut1 := strings.Join(strings.Fields(string(mountCmd1.Out.Contents())), " ")
fmt.Printf("Output: %s", mountOut1)
- Expect(strings.Contains(mountOut1, volName)).To(BeFalse())
+ Expect(mountOut1).To(Not(ContainSubstring(volName)))
ctrName := "testctr"
podmanSession := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "-v", fmt.Sprintf("%s:/testvol", volName), ALPINE, "top"})
@@ -303,7 +303,7 @@ var _ = Describe("Podman run with volumes", func() {
os.Stderr.Sync()
mountOut2 := strings.Join(strings.Fields(string(mountCmd2.Out.Contents())), " ")
fmt.Printf("Output: %s", mountOut2)
- Expect(strings.Contains(mountOut2, volName)).To(BeTrue())
+ Expect(mountOut2).To(ContainSubstring(volName))
// Stop the container to unmount
podmanStopSession := podmanTest.Podman([]string{"stop", "--time", "0", ctrName})
@@ -324,7 +324,7 @@ var _ = Describe("Podman run with volumes", func() {
os.Stderr.Sync()
mountOut3 := strings.Join(strings.Fields(string(mountCmd3.Out.Contents())), " ")
fmt.Printf("Output: %s", mountOut3)
- Expect(strings.Contains(mountOut3, volName)).To(BeFalse())
+ Expect(mountOut3).To(Not(ContainSubstring(volName)))
})
It("podman named volume copyup", func() {
@@ -516,7 +516,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
Expect(runLs).Should(Exit(0))
outputArr := runLs.OutputToStringArray()
Expect(len(outputArr)).To(Equal(1))
- Expect(strings.Contains(outputArr[0], fileName)).To(BeTrue())
+ Expect(outputArr[0]).To(ContainSubstring(fileName))
})
It("Podman mount over image volume with trailing /", func() {
@@ -752,7 +752,7 @@ USER testuser`, fedoraMinimal)
test1 := podmanTest.Podman([]string{"run", "-v", "testvol1:/test", imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
test1.WaitWithDefaultTimeout()
Expect(test1).Should(Exit(0))
- Expect(strings.Contains(test1.OutputToString(), testString)).To(BeTrue())
+ Expect(test1.OutputToString()).To(ContainSubstring(testString))
volName := "testvol2"
vol := podmanTest.Podman([]string{"volume", "create", volName})
@@ -762,7 +762,7 @@ USER testuser`, fedoraMinimal)
test2 := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test", volName), imgName, "bash", "-c", "ls -al /test | grep -v root | grep -v total"})
test2.WaitWithDefaultTimeout()
Expect(test2).Should(Exit(0))
- Expect(strings.Contains(test2.OutputToString(), testString)).To(BeTrue())
+ Expect(test2.OutputToString()).To(ContainSubstring(testString))
})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 2ad8e81e6..bbbec1648 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -93,7 +93,7 @@ WantedBy=default.target
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"})
systemctl.WaitWithDefaultTimeout()
Expect(systemctl).Should(Exit(0))
- Expect(strings.Contains(systemctl.OutputToString(), "State:")).To(BeTrue())
+ Expect(systemctl.OutputToString()).To(ContainSubstring("State:"))
result := podmanTest.Podman([]string{"inspect", ctrName})
result.WaitWithDefaultTimeout()
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index 0389529f7..055be5b19 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -86,6 +86,6 @@ var _ = Describe("Podman volume inspect", func() {
inspect := podmanTest.Podman([]string{"volume", "inspect", volName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
- Expect(strings.Contains(inspect.OutputToString(), "tmpfs")).To(BeTrue())
+ Expect(inspect.OutputToString()).To(ContainSubstring("tmpfs"))
})
})