Skip to content

Commit

Permalink
Fix error propagation in new tests
Browse files Browse the repository at this point in the history
The apache#43979 introduced unit_tests.sh script that did not properly
propagate error codes (no -e/+e setting).

This PR fixes it - also fixes an edge case where the -e setting
is not restored in run breeze commmand script.
  • Loading branch information
potiuk committed Nov 16, 2024
1 parent fa2e4e9 commit 0900de0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
1 change: 1 addition & 0 deletions scripts/ci/testing/run_breeze_command_with_retries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ for i in $(seq 1 "$NUMBER_OF_ATTEMPT") ; do
breeze down
set +e
if breeze "$@"; then
set -e
exit 0
else
echo
Expand Down
34 changes: 32 additions & 2 deletions scripts/ci/testing/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,68 +31,98 @@ TEST_SCOPE=${2}

function core_tests() {
echo "${COLOR_BLUE}Running core tests${COLOR_RESET}"
set +e
if [[ "${TEST_SCOPE}" == "DB" ]]; then
set -x
breeze testing core-tests --run-in-parallel --run-db-tests-only
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "Non-DB" ]]; then
set -x
breeze testing core-tests --use-xdist --skip-db-tests --no-db-cleanup --backend none
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "All" ]]; then
set -x
breeze testing core-tests --run-in-parallel
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "Quarantined" ]]; then
set -x
breeze testing core-tests --test-type "All-Quarantined"
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "ARM collection" ]]; then
set -x
breeze testing core-tests --collect-only --remove-arm-packages --test-type "All"
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "System" ]]; then
set -x
breeze testing system-tests tests/system/example_empty.py
RESULT=$?
set +x
else
echo "Unknown test scope: ${TEST_SCOPE}"
set -e
exit 1
fi
echo "${COLOR_BLUE}Core tests completed${COLOR_RESET}"
set -e
if [[ ${RESULT} != "0" ]]; then
echo
echo "${COLOR_RED}The ${TEST_GROUP} test ${TEST_SCOPE} failed! Giving up${COLOR_RESET}"
echo
exit "${RESULT}"
fi
echo "${COLOR_GREEN}Core tests completed successfully${COLOR_RESET}"
}

function providers_tests() {
echo "${COLOR_BLUE}Running providers tests${COLOR_RESET}"
set +e
if [[ "${TEST_SCOPE}" == "DB" ]]; then
set -x
breeze testing providers-tests --run-in-parallel --run-db-tests-only
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "Non-DB" ]]; then
set -x
breeze testing providers-tests --use-xdist --skip-db-tests --no-db-cleanup --backend none
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "All" ]]; then
set -x
breeze testing providers-tests --run-in-parallel
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "Quarantined" ]]; then
set -x
breeze testing providers-tests --test-type "All-Quarantined"
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "ARM collection" ]]; then
set -x
breeze testing providers-tests --collect-only --remove-arm-packages --test-type "All"
RESULT=$?
set +x
elif [[ "${TEST_SCOPE}" == "System" ]]; then
set -x
breeze testing system-tests providers/tests/system/example_empty.py
RESULT=$?
set +x
else
echo "Unknown test scope: ${TEST_SCOPE}"
set -e
exit 1
fi
echo "${COLOR_BLUE}Providers tests completed${COLOR_RESET}"
set -e
if [[ ${RESULT} != "0" ]]; then
echo
echo "${COLOR_RED}The ${TEST_GROUP} test ${TEST_SCOPE} failed! Giving up${COLOR_RESET}"
echo
exit "${RESULT}"
fi
echo "${COLOR_GREEB}Providers tests completed successfully${COLOR_RESET}"
}


Expand Down

0 comments on commit 0900de0

Please sign in to comment.