Skip to content

Commit

Permalink
ci(tests): better handling of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
donch committed Oct 26, 2023
1 parent b9b0656 commit 90ffb28
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 90ffb28

Please sign in to comment.