From 90ffb2802932be355084bf17b22771b86afef1e0 Mon Sep 17 00:00:00 2001 From: David Donchez Date: Thu, 26 Oct 2023 14:05:29 +0200 Subject: [PATCH] ci(tests): better handling of errors --- .github/workflows/tests.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 89d89494..228cff15 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -168,14 +168,16 @@ jobs: while [[ $attempts -lt 3 && $success == false ]] do response=$(kubectl run curl-pod --image=curlimages/curl --rm -ti --quiet --restart=Never -- curl -s -o /dev/null -w "%{http_code}\n" http://$ip:8080/metrics) - if [[ $response -ge 200 && $response -lt 300 ]]; then + if [[ -z "$response" ]]; then + echo "No HTTP response received from $ip" + elif [[ $response -ge 200 && $response -lt 300 ]]; then echo "HTTP status code $response is valid for $ip" success=true else echo "HTTP status code $response is not valid for $ip" - ((attempts++)) - sleep 5 fi + ((attempts++)) + sleep 3 done if [[ $success == false ]]; then echo "Failed after 3 attempts for $ip"