From ba907883fba59e86506f1b76dfc62d6cc4ed7c97 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Fri, 4 Dec 2015 16:35:02 -0800 Subject: [PATCH] Try to fix rare test flake in services e2e --- test/e2e/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/service.go b/test/e2e/service.go index ca240c8aadd..2f20ab637f8 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -394,8 +394,10 @@ var _ = Describe("Services", func() { ip := pickNodeIP(c) testReachable(ip, nodePort) + By("verifying the node port is locked") hostExec := LaunchHostExecPod(f.Client, f.Namespace.Name, "hostexec") - cmd := fmt.Sprintf(`ss -ant46 'sport = :%d' | tail -n +2 | grep LISTEN`, nodePort) + // Loop a bit because we see transient flakes. + cmd := fmt.Sprintf(`for i in $(seq 1 10); do if ss -ant46 'sport = :%d' | grep ^LISTEN; then exit 0; fi; sleep 0.1; done; exit 1`, nodePort) stdout, err := RunHostCmd(hostExec.Namespace, hostExec.Name, cmd) if err != nil { Failf("expected node port (%d) to be in use, stdout: %v", nodePort, stdout)