summaryrefslogtreecommitdiff
path: root/test/e2e/run_networking_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-01 08:43:25 -0800
committerGitHub <noreply@github.com>2019-03-01 08:43:25 -0800
commit55f80719a6b73c23c579bd4cc68cd8c382e7f860 (patch)
tree3c949283191697f7ef0557649140ca4a1c9c9034 /test/e2e/run_networking_test.go
parentc80416f0346200c7906cfc16c6101594653a0ad6 (diff)
parentf67859ffb396be13cb8c4b8d91343b77de4eb288 (diff)
downloadpodman-55f80719a6b73c23c579bd4cc68cd8c382e7f860.tar.gz
podman-55f80719a6b73c23c579bd4cc68cd8c382e7f860.tar.bz2
podman-55f80719a6b73c23c579bd4cc68cd8c382e7f860.zip
Merge pull request #2481 from cevich/sysexec_waitcomplete
Fix SystemExec completion race
Diffstat (limited to 'test/e2e/run_networking_test.go')
-rw-r--r--test/e2e/run_networking_test.go33
1 files changed, 22 insertions, 11 deletions
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index a07e4d047..c89a4f487 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -58,7 +58,6 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- results.Wait(30)
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring("222"))
Expect(results.OutputToString()).To(ContainSubstring("223"))
@@ -69,12 +68,10 @@ var _ = Describe("Podman run networking", func() {
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
results := SystemExec("iptables", []string{"-t", "nat", "-L"})
- results.Wait(30)
Expect(results.ExitCode()).To(Equal(0))
Expect(results.OutputToString()).To(ContainSubstring("8000"))
ncBusy := SystemExec("nc", []string{"-l", "-p", "80"})
- ncBusy.Wait(10)
Expect(ncBusy.ExitCode()).ToNot(Equal(0))
})
@@ -183,26 +180,40 @@ var _ = Describe("Podman run networking", func() {
if Containerized() {
Skip("Can not be run within a container.")
}
- SystemExec("ip", []string{"netns", "add", "xxx"})
+ addXXX := SystemExec("ip", []string{"netns", "add", "xxx"})
+ Expect(addXXX.ExitCode()).To(Equal(0))
+ defer func() {
+ delXXX := SystemExec("ip", []string{"netns", "delete", "xxx"})
+ Expect(delXXX.ExitCode()).To(Equal(0))
+ }()
+
session := podmanTest.Podman([]string{"run", "-dt", "--net", "ns:/run/netns/xxx", ALPINE, "wget", "www.podman.io"})
session.Wait(90)
Expect(session.ExitCode()).To(Equal(0))
- SystemExec("ip", []string{"netns", "delete", "xxx"})
})
It("podman run n user created network namespace with resolv.conf", func() {
if Containerized() {
Skip("Can not be run within a container.")
}
- SystemExec("ip", []string{"netns", "add", "xxx"})
- SystemExec("mkdir", []string{"-p", "/etc/netns/xxx"})
- SystemExec("bash", []string{"-c", "echo nameserver 11.11.11.11 > /etc/netns/xxx/resolv.conf"})
- session := podmanTest.Podman([]string{"run", "--net", "ns:/run/netns/xxx", ALPINE, "cat", "/etc/resolv.conf"})
+ addXXX2 := SystemExec("ip", []string{"netns", "add", "xxx2"})
+ Expect(addXXX2.ExitCode()).To(Equal(0))
+ defer func() {
+ delXXX2 := SystemExec("ip", []string{"netns", "delete", "xxx2"})
+ Expect(delXXX2.ExitCode()).To(Equal(0))
+ }()
+
+ mdXXX2 := SystemExec("mkdir", []string{"-p", "/etc/netns/xxx2"})
+ Expect(mdXXX2.ExitCode()).To(Equal(0))
+ defer os.RemoveAll("/etc/netns/xxx2")
+
+ nsXXX2 := SystemExec("bash", []string{"-c", "echo nameserver 11.11.11.11 > /etc/netns/xxx2/resolv.conf"})
+ Expect(nsXXX2.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"run", "--net", "ns:/run/netns/xxx2", ALPINE, "cat", "/etc/resolv.conf"})
session.Wait(90)
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("11.11.11.11"))
- SystemExec("ip", []string{"netns", "delete", "xxx"})
- SystemExec("rm", []string{"-rf", "/etc/netns/xxx"})
})
It("podman run network in bogus user created network namespace", func() {