aboutsummaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-12-11 18:05:25 -0500
committerMatthew Heon <mheon@redhat.com>2018-12-12 15:41:13 -0500
commitc93ad3762c402c56d6cbb1c7a6f1202b4962eeb4 (patch)
tree6c6cb86ce5e21f8e16f3c7b9662b3c6b3337fdfe /test/e2e
parentaa9507054d820a2a2999538c04057d8100c15c55 (diff)
downloadpodman-c93ad3762c402c56d6cbb1c7a6f1202b4962eeb4.tar.gz
podman-c93ad3762c402c56d6cbb1c7a6f1202b4962eeb4.tar.bz2
podman-c93ad3762c402c56d6cbb1c7a6f1202b4962eeb4.zip
Add test for sharing resolv and hosts with netns
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/run_networking_test.go33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 1b05ac031..68b1f06de 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -9,7 +9,7 @@ import (
. "github.com/onsi/gomega"
)
-var _ = Describe("Podman rmi", func() {
+var _ = Describe("Podman run networking", func() {
var (
tempdir string
err error
@@ -145,4 +145,35 @@ var _ = Describe("Podman rmi", func() {
match, _ := session.GrepString("foobar")
Expect(match).Should(BeTrue())
})
+
+ It("podman run --net container: copies hosts and resolv", func() {
+ ctrName := "ctr1"
+ ctr1 := podmanTest.RunTopContainer(ctrName)
+ ctr1.WaitWithDefaultTimeout()
+ Expect(ctr1.ExitCode()).To(Equal(0))
+
+ // Exec in and modify /etc/resolv.conf and /etc/hosts
+ exec1 := podmanTest.Podman([]string{"exec", ctrName, "sh", "-c", "echo nameserver 192.0.2.1 > /etc/resolv.conf"})
+ exec1.WaitWithDefaultTimeout()
+ Expect(exec1.ExitCode()).To(Equal(0))
+
+ exec2 := podmanTest.Podman([]string{"exec", ctrName, "sh", "-c", "echo 192.0.2.2 test1 > /etc/hosts"})
+ exec2.WaitWithDefaultTimeout()
+ Expect(exec2.ExitCode()).To(Equal(0))
+
+ ctrName2 := "ctr2"
+ ctr2 := podmanTest.Podman([]string{"run", "-d", "--net=container:" + ctrName, "--name", ctrName2, ALPINE, "top"})
+ ctr2.WaitWithDefaultTimeout()
+ Expect(ctr2.ExitCode()).To(Equal(0))
+
+ exec3 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/resolv.conf"})
+ exec3.WaitWithDefaultTimeout()
+ Expect(exec3.ExitCode()).To(Equal(0))
+ Expect(exec3.OutputToString()).To(ContainSubstring("nameserver 192.0.2.1"))
+
+ exec4 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/hosts"})
+ exec4.WaitWithDefaultTimeout()
+ Expect(exec4.ExitCode()).To(Equal(0))
+ Expect(exec4.OutputToString()).To(ContainSubstring("192.0.2.2 test1"))
+ })
})