summaryrefslogtreecommitdiff
path: root/test/e2e/run_networking_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-09-16 12:37:06 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-16 18:19:15 +0200
commitf1ee234252768921313ddbbdbb7184585800bdbb (patch)
tree157ced3a14d7ef97f1ab059dc033d83c556cf0a5 /test/e2e/run_networking_test.go
parent9119a578e782b92bd344f093f5491c318bc20d69 (diff)
downloadpodman-f1ee234252768921313ddbbdbb7184585800bdbb.tar.gz
podman-f1ee234252768921313ddbbdbb7184585800bdbb.tar.bz2
podman-f1ee234252768921313ddbbdbb7184585800bdbb.zip
Only add 127.0.0.1 entry to /etc/hosts with --net=none
The check for net=none was wrong. It just assumed when we do not create the netns but have one set that we use the none mode. This however also applies to a container which joins the pod netns. To correctly check for the none mode use `config.NetMode.IsNone()`. Fixes #11596 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/e2e/run_networking_test.go')
-rw-r--r--test/e2e/run_networking_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 8eabeba97..c7ffdaf4c 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -709,6 +709,18 @@ var _ = Describe("Podman run networking", func() {
Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue())
})
+ It("podman run with pod does not add extra 127 entry to /etc/hosts", func() {
+ pod := "testpod"
+ hostname := "test-hostname"
+ run := podmanTest.Podman([]string{"pod", "create", "--hostname", hostname, "--name", pod})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+ run = podmanTest.Podman([]string{"run", "--pod", pod, ALPINE, "cat", "/etc/hosts"})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+ Expect(run.OutputToString()).ToNot(ContainSubstring("127.0.0.1 %s", hostname))
+ })
+
ping_test := func(netns string) {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", netns, "--hostname", hostname, ALPINE, "ping", "-c", "1", hostname})