Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/scoped-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ jobs:
env:
CHANGED_GOLANG_SOURCES: ${{ needs.changedfiles.outputs.go_sources }}
run: |
make for-affected-components CMD="make"
make for-affected-components CMD="make lint test-three-times"
13 changes: 12 additions & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ common: lint test
test: $(GOTESTSUM)
$(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- $(GOTEST_OPT)

# This target is used in scoped tests.
# We do not pass GOTESTSUM_OPT so that we do not re-run failures
# and run each changed test three times.
#
# This helps us catch flakes more easily before they land on main.
test-three-times: $(GOTESTSUM)
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -count=3

.PHONY: test-with-cover
test-with-cover: $(GOTESTSUM)
mkdir -p $(PWD)/coverage/unit
Expand Down Expand Up @@ -292,6 +300,9 @@ for-affected-components:
fi \
fi

# Do not pass GOTESTSUM_OPT so that we do not re-run failures
# and run each changed test three times.
# This helps us catch flakes more easily before they land on main.
CHANGED_GOLANG_TESTS?=$(shell git diff main --name-only | grep -E '.*_test\.go$$')
.PHONY: run-changed-tests
run-changed-tests:
Expand All @@ -306,7 +317,7 @@ run-changed-tests:
else \
set -e; for dir in $$(echo $${AFFECTED_TEST_DIRS}); do \
(cd "$${dir}" && \
$(GOTESTSUM) $(GOTESTSUM_OPT) --packages="./..." -- $(GOTEST_OPT) ); \
$(GOTESTSUM) --packages="./..." -- $(GOTEST_OPT) -count=3 ); \
done \
fi \
fi