Skip to content

Commit

Permalink
Netavark userns test: give aardvark time to come up
Browse files Browse the repository at this point in the history
Nasty test flake, "bad address nc-server.dns.podman"

Cause: "There is absolutely no guarantee that aardvark-dns
is ready before the container is started." (source: Paul).

Workaround (not a real solution): wait before doing a host lookup.

Also: remove a 99%-duplicate test.

Closes: containers#16272   (I hope)

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Apr 25, 2023
1 parent db0576e commit bdf3679
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions test/e2e/run_networking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,31 +965,6 @@ EXPOSE 2004-2005/tcp`, ALPINE)
})

It("podman network works across user ns", func() {
netName := stringid.GenerateRandomID()
create := podmanTest.Podman([]string{"network", "create", netName})
create.WaitWithDefaultTimeout()
Expect(create).Should(Exit(0))
defer podmanTest.removeNetwork(netName)

name := "nc-server"
run := podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "-d", "--name", name, "--net", netName, ALPINE, "nc", "-l", "-p", "9480"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))

// NOTE: we force the k8s-file log driver to make sure the
// tests are passing inside a container.
run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 9480", name)})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))

log := podmanTest.Podman([]string{"logs", name})
log.WaitWithDefaultTimeout()
Expect(log).Should(Exit(0))
Expect(log.OutputToString()).To(Equal("podman"))
})

It("podman Netavark network works across user ns", func() {
SkipIfCNI(podmanTest)
netName := createNetworkName("")
create := podmanTest.Podman([]string{"network", "create", netName})
create.WaitWithDefaultTimeout()
Expand All @@ -1003,7 +978,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)

// NOTE: we force the k8s-file log driver to make sure the
// tests are passing inside a container.
run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 9480", name)})
// "sleep" needed to give aardvark-dns time to come up; #16272
run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("sleep 2;echo podman | nc -w 1 %s.dns.podman 9480", name)})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))

Expand Down

0 comments on commit bdf3679

Please sign in to comment.