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
This commit is contained in:
Antonio Ojea 2023-05-05 23:07:52 +00:00
parent ace6a79372
commit 4e24237f3b

View File

@ -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