Skip to content

Commit

Permalink
Handle a 0 exit code from the remote runner instead of always failing (
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon authored Feb 13, 2024
1 parent 85e8858 commit 1d0f9ec
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions integration-tests/scripts/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
exit 0

0 comments on commit 1d0f9ec

Please sign in to comment.