summaryrefslogtreecommitdiff
path: root/test/e2e/run_networking_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/run_networking_test.go')
-rw-r--r--test/e2e/run_networking_test.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index e2004c8e0..22ec27346 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -551,8 +551,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- match, _ := session.GrepString(hostname)
- Expect(match).Should(BeFalse())
+ Expect(session.OutputToString()).To(Not(ContainSubstring(hostname)))
})
It("podman run --net host hostname test", func() {
@@ -758,7 +757,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 +765,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 +773,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() {
@@ -789,7 +788,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(run.OutputToString()).ToNot(ContainSubstring("127.0.0.1 %s", hostname))
})
- ping_test := func(netns string) {
+ pingTest := func(netns string) {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", netns, "--hostname", hostname, ALPINE, "ping", "-c", "1", hostname})
run.WaitWithDefaultTimeout()
@@ -801,11 +800,11 @@ EXPOSE 2004-2005/tcp`, ALPINE)
}
It("podman attempt to ping container name and hostname --net=none", func() {
- ping_test("--net=none")
+ pingTest("--net=none")
})
It("podman attempt to ping container name and hostname --net=private", func() {
- ping_test("--net=private")
+ pingTest("--net=private")
})
It("podman run check dnsname plugin", func() {
@@ -866,7 +865,6 @@ EXPOSE 2004-2005/tcp`, ALPINE)
inspectOut := podmanTest.InspectContainer(ctrName)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Networks)).To(Equal(1))
- _, ok := inspectOut[0].NetworkSettings.Networks["podman"]
- Expect(ok).To(BeTrue())
+ Expect(inspectOut[0].NetworkSettings.Networks).To(HaveKey("podman"))
})
})