Router tests should check for curl errors
All errors should be logged. A future check should verify there are no
temporary failures once the router begins responding, but this fixes the
issue where the router is not yet running and refuses the connection.
@@ -131,7 +131,8 @@ func waitForRouterOKResponseExec(ns, execPodName, url, host string, timeoutSecon
cmd := fmt.Sprintf(`
set -e
for i in $(seq 1 %d); do
- code=$( curl -s -o /dev/null -w '%%{http_code}\n' --header 'Host: %s' %q )
+ code=$( curl -s -o /dev/null -w '%%{http_code}\n' --header 'Host: %s' %q ) || rc=$?
+ if [[ "${rc:-0}" -eq 0 ]]; then
echo $code
if [[ $code -eq 200 ]]; then
exit 0
@@ -139,6 +140,9 @@ func waitForRouterOKResponseExec(ns, execPodName, url, host string, timeoutSecon
if [[ $code -ne 503 ]]; then
exit 1
fi
+ else
+ echo "error ${rc}" 1>&2
+ fi
sleep 1
done
`, timeoutSeconds, host, url)
@@ -157,11 +161,15 @@ func expectRouteStatusCodeRepeatedExec(ns, execPodName, url, host string, status
cmd := fmt.Sprintf(`
set -e
for i in $(seq 1 %d); do
- code=$( curl -s -o /dev/null -w '%%{http_code}\n' --header 'Host: %s' %q )
+ code=$( curl -s -o /dev/null -w '%%{http_code}\n' --header 'Host: %s' %q ) || rc=$?
+ if [[ "${rc:-0}" -eq 0 ]]; then
echo $code
if [[ $code -ne %d ]]; then
exit 1
fi
+ else
+ echo "error ${rc}" 1>&2
+ fi
done
`, times, host, url, statusCode)
output, err := e2e.RunHostCmd(ns, execPodName, cmd)
