From bdf367958e814faaed31dc9f169c3002ebb444c1 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 25 Apr 2023 06:54:37 -0600 Subject: [PATCH] Netavark userns test: give aardvark time to come up 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: #16272 (I hope) Signed-off-by: Ed Santiago --- test/e2e/run_networking_test.go | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index db9a009cb2..0cfa90a2c5 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -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() @@ -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))