summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-20 15:18:53 -0400
committerGitHub <noreply@github.com>2020-10-20 15:18:53 -0400
commit6961b9475dbcbc6112d9c6022ac264c923ce083d (patch)
tree5536944fef8861aef90873b9687730262a2dcebc /test
parent36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8 (diff)
parent1b288a35ba931c0b524af550749a7c1fd48b452f (diff)
downloadpodman-6961b9475dbcbc6112d9c6022ac264c923ce083d.tar.gz
podman-6961b9475dbcbc6112d9c6022ac264c923ce083d.tar.bz2
podman-6961b9475dbcbc6112d9c6022ac264c923ce083d.zip
Merge pull request #8067 from mheon/net_host_hosts
Ensure that hostname is added to hosts with net=host
Diffstat (limited to 'test')
-rw-r--r--test/e2e/run_networking_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index e14482db7..540ac5409 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -571,4 +571,19 @@ var _ = Describe("Podman run networking", func() {
podrm.WaitWithDefaultTimeout()
Expect(podrm.ExitCode()).To(BeZero())
})
+
+ It("podman run net=host adds entry to /etc/hosts", func() {
+ run := podmanTest.Podman([]string{"run", "--net=host", ALPINE, "cat", "/etc/hosts"})
+ run.WaitWithDefaultTimeout()
+ Expect(run.ExitCode()).To(BeZero())
+ Expect(strings.Contains(run.OutputToString(), "127.0.1.1")).To(BeTrue())
+ })
+
+ It("podman run with --net=host and --hostname sets correct hostname", func() {
+ hostname := "testctr"
+ 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())
+ })
})