From 0a7bdaccbf499bafb5d9b164c0a0f7eb590372f2 Mon Sep 17 00:00:00 2001 From: Jayendra Parsai Date: Thu, 5 Dec 2024 11:15:00 +0530 Subject: [PATCH] fix: fix race condition in e2e test 1-057_validate_notifications (#817) Signed-off-by: Jayendra Parsai Co-authored-by: Jayendra Parsai --- .../05-verify-email.yaml | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/openshift/e2e/parallel/1-057_validate_notifications/05-verify-email.yaml b/test/openshift/e2e/parallel/1-057_validate_notifications/05-verify-email.yaml index adf7a6828..817b1f912 100644 --- a/test/openshift/e2e/parallel/1-057_validate_notifications/05-verify-email.yaml +++ b/test/openshift/e2e/parallel/1-057_validate_notifications/05-verify-email.yaml @@ -3,17 +3,25 @@ kind: TestStep commands: - script: | set -e - sleep 5 smtp4dev_pod=$(kubectl get pod -l=app=smtp4dev -o NAME -n $NAMESPACE) - exit_code=$(kubectl -n $NAMESPACE exec --stdin "${smtp4dev_pod}" -- /bin/bash \ - -c 'if [[ $(grep -rnw /tmp -e "Subject: Application my-app-3 has been created.") ]]; then - exit 0; else - exit 1; - fi') + while : + do + if [[ $timer -eq 120 ]]; then + echo "timed out while waiting for email notification" + exit 1 + fi + + exit_code=$(kubectl -n $NAMESPACE exec --stdin "${smtp4dev_pod}" -- /bin/bash \ + -c 'if [[ $(grep -rnw /tmp -e "Subject: Application my-app-3 has been created.") ]]; then + exit 0; else + exit 1; + fi') - if [[ $exit_code -eq 0 ]]; then + if [[ $exit_code -eq 0 ]]; then exit 0 - else - exit 1 - fi \ No newline at end of file + fi + + timer=$((timer+5)) + sleep 5 + done \ No newline at end of file