Skip to content

test: use gotestsum to retry only the failing test #1990

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
23 changes: 5 additions & 18 deletions .github/workflows/router-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,9 @@ jobs:
strategy:
fail-fast: false
matrix:
test_target:
[
'./. ./fuzzquery ./lifecycle ./modules',
'./telemetry',
'./events',
]
make_target:
- integration-tests
- integration-tests-flaky
services:
nats:
image: ghcr.io/wundergraph/cosmo/nats:2.11.0-alpine
Expand Down Expand Up @@ -222,19 +219,9 @@ jobs:
redis-cli -u "redis://cosmo:[email protected]:$port" ping
echo "ACL user 'cosmo' created with full access on port $port"
done
- name: Run Integration tests ${{ matrix.test_target }}
- name: Run Integration Tests
working-directory: ./router-tests
run: make test test_params="-run '^Test[^(Flaky)]' --timeout=5m -p 1 --parallel 10" test_target="${{ matrix.test_target }}"
- name: Run Flaky Integration tests ${{ matrix.test_target }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 5
retry_wait_seconds: 5
retry_on: error
command: |
cd router-tests
make test test_params="-run '^TestFlaky' --timeout=5m --parallel 1" test_target="${{ matrix.test_target }}"
run: make ${{ matrix.make_target }}

image_scan:
if: github.event.pull_request.head.repo.full_name == github.repository
Expand Down
8 changes: 7 additions & 1 deletion router-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test-deps:
$(MAKE) -C ../demo plugin-build-ci

test: test-deps
gotestsum -f $(FORMAT) -- -ldflags=-extldflags=-Wl,-ld_classic $(test_params) -race $(test_target)
gotestsum $(gotestsum_params) --packages=$(test_target) -f $(FORMAT) -- -ldflags=-extldflags=-Wl,-ld_classic $(test_params) -race $(test_target)

update-snapshot:
go test -update -race $(test_target)
Expand Down Expand Up @@ -44,3 +44,9 @@ update-test-config:

bump-deps:
./bump-deps.sh

integration-tests:
$(MAKE) test test_params="-run '^Test[^(Flaky)]' --timeout=10m" test_target="./..."

integration-tests-flaky:
$(MAKE) test gotestsum_params="--rerun-fails=5" test_params="-run '^TestFlaky' --timeout=10m -p 1 --parallel 10" test_target="./..."
Loading