Skip to content

Commit

Permalink
Improve Integration Test Suite Resilience (#273)
Browse files Browse the repository at this point in the history
* Improve Integration Test Suite Resiliency
  • Loading branch information
zombieobject authored Mar 2, 2024
1 parent 990f4af commit 0e4e79c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
- name: Start Docker containers
run: dev/up

# retries are added due to test failures with dependencies
- name: Run tests
run: swift test --vv
run: script/run_tests.sh

- name: Stop local test server
run: docker-compose -p xmtp-ios -f dev/local/docker-compose.yml down
25 changes: 25 additions & 0 deletions script/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

retries=0
# Given the resource limitations and external dependencies for the test suite,
# a retry count of at least 10 is needed.
until [ $retries -ge 10 ]
do
echo "Running Test Suite Attempt ($retries)...."
swift test -v | grep -E "Test Case|XCTAssert|failures"

exit_code=$?

if [ $exit_code -eq 0 ]; then
echo "Test Succeeded"
break
else
((retries=retries+1))
echo "Test Suite Failed."
fi
done

if [ $retries -ge 10 ]; then
echo "Maximum number of retries exceeded. Exiting with status code 1."
exit 1
fi

0 comments on commit 0e4e79c

Please sign in to comment.