Skip to content

Commit

Permalink
retry tests max 3 times
Browse files Browse the repository at this point in the history
  • Loading branch information
antonilol committed Apr 19, 2022
1 parent 7df223e commit 884d86d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Integration Test
name: Integration Tests
on:
pull_request:
branches:
- master

jobs:
build:
integration-test:
runs-on: ubuntu-18.04
strategy:
matrix:
Expand Down Expand Up @@ -53,5 +53,4 @@ jobs:
cp stack/relay/NODES.json relay/src/tests/configs/nodes.json
- name: Run tests
working-directory: ./relay
run: |
npx ava src/tests/controllers/${{matrix.test-name}}.test.ts --verbose --serial --timeout=2m
run: .github/workflows/test.sh ${{matrix.test-name}}
19 changes: 19 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

delay=10
retries=3

i=0

while true; do
if (npx ava src/tests/controllers/"$1".test.ts --verbose --serial --timeout=2m); then
break
else
((i++))
if [ $i -gt $retries ]; then
exit 1
fi
echo Test failed, retrying in "$delay"s "($i/$tries)"
sleep $delay
fi
done

0 comments on commit 884d86d

Please sign in to comment.