From 0864d82cb57097e6632fd2206d4e5b42861ec6e2 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 21 Oct 2020 13:45:41 -0400 Subject: Add hostname to /etc/hosts for --net=none This does not match Docker, which does not add hostname in this case, but it seems harmless enough. Fixes #8095 Signed-off-by: Matthew Heon --- test/e2e/run_networking_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test/e2e/run_networking_test.go') diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 540ac5409..76d5c4cdc 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -584,6 +584,14 @@ var _ = Describe("Podman run networking", func() { run := podmanTest.Podman([]string{"run", "--net=host", "--hostname", hostname, ALPINE, "hostname"}) run.WaitWithDefaultTimeout() Expect(run.ExitCode()).To(BeZero()) - Expect(strings.Contains(run.OutputToString(), "testctr")).To(BeTrue()) + Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue()) + }) + + It("podman run with --net=none adds hostname to /etc/hosts", func() { + hostname := "testctr" + run := podmanTest.Podman([]string{"run", "--net=none", "--hostname", hostname, ALPINE, "hostname"}) + run.WaitWithDefaultTimeout() + Expect(run.ExitCode()).To(BeZero()) + Expect(strings.Contains(run.OutputToString(), hostname)).To(BeTrue()) }) }) -- cgit v1.2.3-54-g00ecf