From 85f5ef62aab74c97435d20f1e99986402006c5dd Mon Sep 17 00:00:00 2001 From: Tomislav Plavcic Date: Sat, 20 Apr 2024 21:08:37 +0200 Subject: [PATCH] Fix monitoring test --- e2e-tests/functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/e2e-tests/functions b/e2e-tests/functions index 2e2f74656a..a0f8cce75d 100755 --- a/e2e-tests/functions +++ b/e2e-tests/functions @@ -358,18 +358,24 @@ wait_for_running() { wait_for_generation() { local resource="$1" local target_generation="$2" + local max_retry="${3:-96}" echo "Waiting for $resource to reach generation $target_generation..." + retry=0 while true; do current_generation=$(kubectl get "$resource" -o jsonpath='{.metadata.generation}') if [ "$current_generation" -eq "$target_generation" ]; then echo "Resource $resource has reached generation $target_generation." break + elif [[ $retry -ge $max_retry ]]; then + echo "Max retry count $retry reached. The desired generation $target_generation on resource $resource not reached." + exit 1 else echo "Resource $resource is at generation $current_generation. Waiting..." sleep 5 + let retry+=1 fi done }