Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Integration Test Suite Resilience #273

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading