summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-03-03 22:54:41 -0500
committerPeter Hunt <pehunt@redhat.com>2019-03-05 13:15:25 -0500
commit6c8f2072aaa3e0b46b2f8d94331fcc88ec6bff11 (patch)
tree1189b9992d002a641ae8cb00f72d39e3bfceb171 /test
parent3614764b70b8541444e8e9966075ccef082535b0 (diff)
downloadpodman-6c8f2072aaa3e0b46b2f8d94331fcc88ec6bff11.tar.gz
podman-6c8f2072aaa3e0b46b2f8d94331fcc88ec6bff11.tar.bz2
podman-6c8f2072aaa3e0b46b2f8d94331fcc88ec6bff11.zip
Append hosts to dependency container's /etc/hosts file
Before, any container with a netNS dependency simply used its dependency container's hosts file, and didn't abide its configuration (mainly --add-host). Fix this by always appending to the dependency container's hosts file, creating one if necessary. Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/pod_infra_container_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index ed5002ca7..d9e5d380a 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -360,4 +360,21 @@ var _ = Describe("Podman pod create", func() {
Expect(result.OutputToString()).To(ContainSubstring(infraID))
})
+
+ It("podman run --add-host in pod", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ // verify we can add a host to the infra's /etc/hosts
+ session = podmanTest.Podman([]string{"run", "--pod", podID, "--add-host", "foobar:127.0.0.1", BB, "ping", "-c", "1", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // verify we can see the other hosts of infra's /etc/hosts
+ session = podmanTest.Podman([]string{"run", "--pod", podID, BB, "ping", "-c", "1", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})