Skip to content

Commit

Permalink
Fix monitoring test
Browse files Browse the repository at this point in the history
  • Loading branch information
tplavcic committed Apr 20, 2024
1 parent 9fea774 commit 85f5ef6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 85f5ef6

Please sign in to comment.