Skip to content

Commit 2b67f35

Browse files
committed
If the test run fails with Socket Timeout rerun the test one time
Signed-off-by: Paul Gooderham <[email protected]>
1 parent 82b1829 commit 2b67f35

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

.github/workflows/build.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ jobs:
117117
- name: 'Run UI integration tests'
118118
id: run_tests
119119
working-directory: ./liberty-tools-intellij
120-
run: bash ./src/test/resources/ci/scripts/run.sh
120+
run: |
121+
bash ./src/test/resources/ci/scripts/run.sh
122+
rc="$?"
123+
if [[ "$rc" == "23" ]]; then
124+
bash ./src/test/resources/ci/scripts/run.sh
125+
fi
121126
- name: 'Archive Test logs and reports'
122127
if: ${{ failure() && steps.run_tests.conclusion == 'failure' }}
123128
uses: actions/[email protected]

src/test/resources/ci/scripts/run.sh

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,27 +176,26 @@ main() {
176176
exit 11
177177
fi
178178

179-
# Retry the tests if they fail with a SocketTimeoutException up to three times
180-
for retry in {1..3}; do
181-
startIDE
182-
# Run the tests
183-
echo -e "\n$(${currentTime[@]}): INFO: Running tests..."
184-
set -o pipefail # using tee requires we use this setting to gather the rc of gradlew
185-
./gradlew test -PuseLocal=$USE_LOCAL_PLUGIN | tee "$currentLoc"/build/junit.out
186-
testRC=$?
187-
set +o pipefail # reset this option
188-
grep -i "SocketTimeoutException" "$currentLoc"/build/junit.out
189-
rc=$?
190-
if [ "$rc" -ne 0 ]; then
191-
# rc=1 means the exception string was not found
192-
break
193-
fi
194-
done
179+
JUNIT_OUTPUT_TXT="$currentLoc"/build/junit.out
180+
startIDE
181+
# Run the tests
182+
echo -e "\n$(${currentTime[@]}): INFO: Running tests..."
183+
set -o pipefail # using tee requires we use this setting to gather the rc of gradlew
184+
./gradlew test -PuseLocal=$USE_LOCAL_PLUGIN | tee "$JUNIT_OUTPUT_TXT"
185+
testRC=$?
186+
set +o pipefail # reset this option
195187

196188
# If there were any errors, gather some debug data before exiting.
197189
if [ "$testRC" -ne 0 ]; then
198190
echo -e "\n$(${currentTime[@]}): ERROR: Failure while running tests. rc: ${$testRC}."
199191
gatherDebugData "$currentLoc"
192+
grep -i "SocketTimeoutException" "$JUNIT_OUTPUT_TXT"
193+
rc=$?
194+
if [ "$rc" -eq 0 ]; then
195+
# rc=0 means the exception string *was* found
196+
# This exit code detected in build script
197+
exit 23
198+
fi
200199
exit -1
201200
fi
202201
}

0 commit comments

Comments
 (0)