File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- # Usage: ./run-consecutive-tests.sh "<test-coordinates>" '[ "1.0", "2.0", "3.0" ]'
4-
53set -u
64set -x
75
1311# Input parameters
1412TEST_COORDINATES=" $1 "
1513VERSIONS_JSON=" $2 "
16- PASSED_VERSIONS=()
17- FAILED_VERSION=" "
18-
19- # Parse JSON array into Bash array using jq
20- if ! command -v jq & > /dev/null; then
21- echo " jq is required but not installed."
22- exit 1
23- fi
2414
2515# Remove surrounding single quotes if present (when called from workflow)
2616VERSIONS_JSON=" ${VERSIONS_JSON# " ${VERSIONS_JSON%% [!\']* } " } "
@@ -33,15 +23,22 @@ for VERSION in "${VERSIONS[@]}"; do
3323 echo " Running test with GVM_TCK_LV=$VERSION and coordinates=$TEST_COORDINATES "
3424 GVM_TCK_LV=" $VERSION " ./gradlew test -Pcoordinates=" $TEST_COORDINATES "
3525 RESULT=$?
26+
27+ ATTEMPTS=1
28+ # maybe we failed because the test was flaky => try two more times to be sure
29+ while [ " $RESULT " -ne 0 ] && [ $ATTEMPTS -le 2 ]; do
30+ echo " Re-running the test with GVM_TCK_LV=$VERSION and coordinates=$TEST_COORDINATES "
31+ GVM_TCK_LV=" $VERSION " ./gradlew clean test -Pcoordinates=" $TEST_COORDINATES "
32+ RESULT=$?
33+ ATTEMPTS=$(( ATTEMPTS + 1 ))
34+ done
35+
3636 if [ " $RESULT " -eq 0 ]; then
37- PASSED_VERSIONS+=(" $VERSION " )
3837 echo " PASSED:$VERSION "
3938 else
40- FAILED_VERSION=" $VERSION "
4139 echo " FAILED:$VERSION "
4240 break
4341 fi
4442done
4543
46- # Script ends here; output already provided in loop for workflows to process
4744exit 0
You can’t perform that action at this time.
0 commit comments