Skip to content

Commit

Permalink
Added retry for docker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Nov 18, 2024
1 parent 3409036 commit 7b4c02c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ jobs:
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "<>"
./run.sh
./run_retry.sh
19 changes: 19 additions & 0 deletions app-tests/run_retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Reduce flaky tests by retrying them

MAX_RETRIES=5
RETRY_COUNT=0

while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
echo "Running test (attempt $((RETRY_COUNT+1)) of $MAX_RETRIES)..."
./run-your-tests-command.sh && break
RETRY_COUNT=$((RETRY_COUNT + 1))
echo "Test failed, retrying..."
done

if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
echo "Tests failed after $MAX_RETRIES attempts."
exit 1
fi

echo "Tests passed successfully."

0 comments on commit 7b4c02c

Please sign in to comment.