From 4e24237f3bc20e19908d6eb30e3427ecf0efe9f2 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Fri, 5 May 2023 23:07:52 +0000 Subject: [PATCH] e2e services: retry if healthcheck nodeport is not avaioable There are some e2e tets on networking services that depend on the healthcheck nodeport to be available. However, the healtcheck nodeport will be available asynchronously, so we should wait until it is available on the tests and not fail hard if it is not. Change-Id: I595402c070c263f0e7855ee8d5662ae975dbd1d3 --- test/e2e/network/service.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 6e6275f90f1..c23b3c6a509 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -2757,11 +2757,13 @@ var _ = common.SIGDescribe("Services", func() { cmd := fmt.Sprintf(`curl -s -o /dev/null -w "%%{http_code}" --connect-timeout 5 http://%s/healthz`, healthCheckNodePortAddr) out, err := e2eoutput.RunHostCmd(pausePod0.Namespace, pausePod0.Name, cmd) if err != nil { - return false, err + framework.Logf("unexpected error trying to connect to nodeport %d : %v", healthCheckNodePortAddr, err) + return false, nil } expectedOut := "200" if out != expectedOut { + framework.Logf("expected output: %s , got %s", expectedOut, out) return false, nil } return true, nil @@ -2778,11 +2780,13 @@ var _ = common.SIGDescribe("Services", func() { cmd := fmt.Sprintf(`curl -s -o /dev/null -w "%%{http_code}" --connect-timeout 5 http://%s/healthz`, healthCheckNodePortAddr) out, err := e2eoutput.RunHostCmd(pausePod0.Namespace, pausePod0.Name, cmd) if err != nil { - return false, err + framework.Logf("unexpected error trying to connect to nodeport %d : %v", healthCheckNodePortAddr, err) + return false, nil } expectedOut := "503" if out != expectedOut { + framework.Logf("expected output: %s , got %s", expectedOut, out) return false, nil } return true, nil