From 1d0f9ec63433bb6c48688f7002621451736bb4dc Mon Sep 17 00:00:00 2001 From: Tate Date: Tue, 13 Feb 2024 15:18:08 -0700 Subject: [PATCH] Handle a 0 exit code from the remote runner instead of always failing (#12015) --- integration-tests/scripts/entrypoint | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/integration-tests/scripts/entrypoint b/integration-tests/scripts/entrypoint index 8797765ab2c..d4ebe722a1d 100755 --- a/integration-tests/scripts/entrypoint +++ b/integration-tests/scripts/entrypoint @@ -21,14 +21,17 @@ exit_code=$? echo "Test exit code: ${exit_code}" -# 3 is the code for an interrupted test, we only want to restart the test when the test is interrupted and in a state -# that it can recover from. Otherwise we mark the test as "passed" as far as K8s is concerned so it doesn't restart it. -if [ $exit_code -eq 3 ]; then -echo "Test was interrupted, exiting with 1 exit code to trigger K8s to restart" - exit 1 # Exiting with non-zero status to trigger pod restart -else - echo "Test either panicked or had some sort of failure. We're exiting with a non-zero exit code so that K8s doesn't restart the pod." - echo "TEST_FAILED" +# Check if the test did not pass (non-zero exit code) +if [ $exit_code -ne 0 ]; then + # 3 is the code for an interrupted test, we only want to restart the test when the test is interrupted and in a state + # that it can recover from. Otherwise we mark the test as "passed" as far as K8s is concerned so it doesn't restart it. + if [ $exit_code -eq 3 ]; then + echo "Test was interrupted, exiting with 1 exit code to trigger K8s to restart" + exit 1 # Exiting with non-zero status to trigger pod restart + else + echo "Test either panicked or had some sort of failure. We're exiting with a non-zero exit code so that K8s doesn't restart the pod." + echo "TEST_FAILED" + fi fi # Sleep for the amount of time provided by the POST_RUN_SLEEP env var @@ -44,4 +47,4 @@ if [ -n "${UPLOAD_MEM_PROFILE}" ]; then fi echo "Exiting with 0 exit code as test is either completed, or failed and cannot be restarted" -exit 0 \ No newline at end of file +exit 0