Skip to content

Commit bf956ae

Browse files
potiukgopidesupavan
authored andcommitted
Fix error propagation in new tests
The #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.
1 parent 16bc382 commit bf956ae

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

scripts/ci/testing/run_breeze_command_with_retries.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ for i in $(seq 1 "$NUMBER_OF_ATTEMPT") ; do
2828
breeze down
2929
set +e
3030
if breeze "$@"; then
31+
set -e
3132
exit 0
3233
else
3334
echo

scripts/ci/testing/run_unit_tests.sh

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,68 +31,98 @@ TEST_SCOPE=${2}
3131

3232
function core_tests() {
3333
echo "${COLOR_BLUE}Running core tests${COLOR_RESET}"
34+
set +e
3435
if [[ "${TEST_SCOPE}" == "DB" ]]; then
3536
set -x
3637
breeze testing core-tests --run-in-parallel --run-db-tests-only
38+
RESULT=$?
3739
set +x
3840
elif [[ "${TEST_SCOPE}" == "Non-DB" ]]; then
3941
set -x
4042
breeze testing core-tests --use-xdist --skip-db-tests --no-db-cleanup --backend none
43+
RESULT=$?
4144
set +x
4245
elif [[ "${TEST_SCOPE}" == "All" ]]; then
4346
set -x
4447
breeze testing core-tests --run-in-parallel
48+
RESULT=$?
4549
set +x
4650
elif [[ "${TEST_SCOPE}" == "Quarantined" ]]; then
4751
set -x
48-
breeze testing core-tests --test-type "All-Quarantined"
52+
breeze testing core-tests --test-type "All-Quarantined" || true
53+
RESULT=$?
4954
set +x
5055
elif [[ "${TEST_SCOPE}" == "ARM collection" ]]; then
5156
set -x
5257
breeze testing core-tests --collect-only --remove-arm-packages --test-type "All"
58+
RESULT=$?
5359
set +x
5460
elif [[ "${TEST_SCOPE}" == "System" ]]; then
5561
set -x
5662
breeze testing system-tests tests/system/example_empty.py
63+
RESULT=$?
5764
set +x
5865
else
5966
echo "Unknown test scope: ${TEST_SCOPE}"
67+
set -e
6068
exit 1
6169
fi
62-
echo "${COLOR_BLUE}Core tests completed${COLOR_RESET}"
70+
set -e
71+
if [[ ${RESULT} != "0" ]]; then
72+
echo
73+
echo "${COLOR_RED}The ${TEST_GROUP} test ${TEST_SCOPE} failed! Giving up${COLOR_RESET}"
74+
echo
75+
exit "${RESULT}"
76+
fi
77+
echo "${COLOR_GREEN}Core tests completed successfully${COLOR_RESET}"
6378
}
6479

6580
function providers_tests() {
6681
echo "${COLOR_BLUE}Running providers tests${COLOR_RESET}"
82+
set +e
6783
if [[ "${TEST_SCOPE}" == "DB" ]]; then
6884
set -x
6985
breeze testing providers-tests --run-in-parallel --run-db-tests-only
86+
RESULT=$?
7087
set +x
7188
elif [[ "${TEST_SCOPE}" == "Non-DB" ]]; then
7289
set -x
7390
breeze testing providers-tests --use-xdist --skip-db-tests --no-db-cleanup --backend none
91+
RESULT=$?
7492
set +x
7593
elif [[ "${TEST_SCOPE}" == "All" ]]; then
7694
set -x
7795
breeze testing providers-tests --run-in-parallel
96+
RESULT=$?
7897
set +x
7998
elif [[ "${TEST_SCOPE}" == "Quarantined" ]]; then
8099
set -x
81-
breeze testing providers-tests --test-type "All-Quarantined"
100+
breeze testing providers-tests --test-type "All-Quarantined" || true
101+
RESULT=$?
82102
set +x
83103
elif [[ "${TEST_SCOPE}" == "ARM collection" ]]; then
84104
set -x
85105
breeze testing providers-tests --collect-only --remove-arm-packages --test-type "All"
106+
RESULT=$?
86107
set +x
87108
elif [[ "${TEST_SCOPE}" == "System" ]]; then
88109
set -x
89110
breeze testing system-tests providers/tests/system/example_empty.py
111+
RESULT=$?
90112
set +x
91113
else
92114
echo "Unknown test scope: ${TEST_SCOPE}"
115+
set -e
93116
exit 1
94117
fi
95-
echo "${COLOR_BLUE}Providers tests completed${COLOR_RESET}"
118+
set -e
119+
if [[ ${RESULT} != "0" ]]; then
120+
echo
121+
echo "${COLOR_RED}The ${TEST_GROUP} test ${TEST_SCOPE} failed! Giving up${COLOR_RESET}"
122+
echo
123+
exit "${RESULT}"
124+
fi
125+
echo "${COLOR_GREEB}Providers tests completed successfully${COLOR_RESET}"
96126
}
97127

98128

0 commit comments

Comments
 (0)