Skip to content

Commit

Permalink
Require every unit test on a PR to pass 3 runs
Browse files Browse the repository at this point in the history
  • Loading branch information
tnozicka authored and zimnx committed Feb 11, 2021
1 parent 009c290 commit 57f8f4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ jobs:
- uses: actions/checkout@v2
- name: Build
run: make --warn-undefined-variables
- name: Make sure new unit tests aren't flaky
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "GO_TEST_COUNT=-count=3" | tee -a ${GITHUB_ENV}
- name: Test
run: make test --warn-undefined-variables

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ GO_BUILD_BINDIR ?=
GO_LD_EXTRA_FLAGS ?=
GO_TEST_PACKAGES :=./pkg/... # ./cmd/...
GO_TEST_FLAGS ?=-race
GO_TEST_COUNT ?=
GO_TEST_EXTRA_FLAGS ?=
GO_TEST_ARGS ?=
GO_TEST_EXTRA_ARGS ?=
Expand Down Expand Up @@ -155,11 +156,12 @@ update: update-gofmt
.PHONY: update

test-unit:
$(GO) test $(GO_TEST_FLAGS) $(GO_TEST_EXTRA_FLAGS) $(GO_TEST_PACKAGES) $(if $(GO_TEST_ARGS)$(GO_TEST_EXTRA_ARGS),-args $(GO_TEST_ARGS) $(GO_TEST_EXTRA_ARGS))
$(GO) test $(GO_TEST_COUNT) $(GO_TEST_FLAGS) $(GO_TEST_EXTRA_FLAGS) $(GO_TEST_PACKAGES) $(if $(GO_TEST_ARGS)$(GO_TEST_EXTRA_ARGS),-args $(GO_TEST_ARGS) $(GO_TEST_EXTRA_ARGS))
.PHONY: test-unit

test-integration: GO_TEST_PACKAGES :=./test/integration/...
test-integration: GO_TEST_FLAGS += -count=1 -p=1 -timeout 30m -v
test-integration: GO_TEST_COUNT :=-count=1
test-integration: GO_TEST_FLAGS += -p=1 -timeout 30m -v
test-integration: GO_TEST_ARGS += -ginkgo.progress
test-integration: test-unit
.PHONY: test-integration
Expand Down

0 comments on commit 57f8f4e

Please sign in to comment.