diff --git a/.github/scripts/e2e_tests.sh b/.github/scripts/e2e_tests.sh index fb9d2c4e..47fd6941 100755 --- a/.github/scripts/e2e_tests.sh +++ b/.github/scripts/e2e_tests.sh @@ -220,23 +220,12 @@ log_and_run kubectl delete -f cosi-examples/bucketaccess.yaml log_and_run echo "Verifying IAM user '$IAM_USER_NAME' deletion..." log_and_run aws --endpoint-url "$IAM_ENDPOINT" iam get-user --user-name "$IAM_USER_NAME" -# Retry logic for checking user deletion +USER_EXISTS="$(aws --endpoint-url "$IAM_ENDPOINT" iam get-user --user-name "$IAM_USER_NAME" --retry-mode standard --max-attempts 12 --delay $DELAY 2>&1 || true)" -for ((i=1; i<=$ATTEMPTS; i++)); do - USER_EXISTS="$(aws --endpoint-url "$IAM_ENDPOINT" iam get-user --user-name "$IAM_USER_NAME" 2>&1 || true)" - - if [[ "$USER_EXISTS" == *"NoSuchEntity"* ]]; then - log_and_run echo "IAM user '$IAM_USER_NAME' successfully deleted." - break - else - log_and_run echo "Attempt $i: IAM user '$IAM_USER_NAME' still exists. Retrying in $DELETE_DELAY seconds..." - sleep $DELAY - fi -done - -if [[ "$USER_EXISTS" != *"NoSuchEntity"* ]]; then - log_and_run echo "IAM user '$IAM_USER_NAME' was not deleted." - exit 1 +if [[ "$USER_EXISTS" == *"NoSuchEntity"* ]]; then + log_and_run echo "IAM user '$IAM_USER_NAME' successfully deleted." +else + log_and_run echo "IAM user '$IAM_USER_NAME' still exists after retries." fi # Step 13: Test deletion bucket with deletion policy set