Skip to content

Commit

Permalink
chore: skip data race tests with -skip flag (#2204)
Browse files Browse the repository at this point in the history
Closes #1964 via the
**short term** approach.

[Go 1.20](https://tip.golang.org/doc/go1.20#go-command) introduced the
`-skip` flag and this PR skips all the tests that were previously
skipped via `-short` when `make test-race` is run. It is possible that
some of these tests don't contain data races in which case they can be
removed from the argument to `-skip` in future PRs.
  • Loading branch information
rootulp authored Aug 2, 2023
1 parent 99d1a79 commit 9ea27d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests
- name: Run tests
run: make test

test-coverage:
Expand Down Expand Up @@ -44,5 +44,5 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

- name: Run unit tests in race mode
- name: Run tests in race mode
run: make test-race
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ test:
@go test -mod=readonly -timeout 30m ./...
.PHONY: test

## test-short: Run unit tests in short mode.
## test-short: Run tests in short mode.
test-short:
@echo "--> Running tests in short mode"
@go test -mod=readonly ./... -short
Expand All @@ -153,10 +153,12 @@ test-e2e:
@KNUU_NAMESPACE=celestia-app E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m
.PHONY: test-e2e

## test-race: Run unit tests in race mode.
## test-race: Run tests in race mode.
test-race:
# TODO: Remove the -skip flag once the following tests no longer contain data races.
# https://github.com/celestiaorg/celestia-app/issues/1369
@echo "--> Running tests in race mode"
@VERSION=$(VERSION) go test -mod=readonly -race -short ./...
@go test -mod=readonly ./... -v -race -skip "TestPrepareProposalConsistency|TestIntegrationTestSuite|TestQGBRPCQueries|TestSquareSizeIntegrationTest|TestStandardSDKIntegrationTestSuite|TestTxsimCommandFlags|TestTxsimCommandEnvVar|TestMintIntegrationTestSuite|TestQGBCLI|TestUpgrade"
.PHONY: test-race

## test-bench: Run unit tests in bench mode.
Expand Down
2 changes: 1 addition & 1 deletion x/mint/test/mint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (s *IntegrationTestSuite) estimateInflationRate(startHeight int64, endHeigh

// In order for 'go test' to run this suite, we need to create
// a normal test function and pass our suite to suite.Run
func TestIntegrationTestSuite(t *testing.T) {
func TestMintIntegrationTestSuite(t *testing.T) {
if testing.Short() {
t.Skip("skipping mint integration test in short mode.")
}
Expand Down

0 comments on commit 9ea27d4

Please sign in to comment.