Skip to content

Commit

Permalink
Testing: Lint for unparallelized tests without explicit reason (#4746)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtzmn authored Nov 4, 2022
1 parent 207f964 commit 7f94674
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ linters:
- revive
- staticcheck
- typecheck
- paralleltest

severity:
default-severity: error
Expand Down Expand Up @@ -115,6 +116,10 @@ issues:
# - revive
- staticcheck
- typecheck
# Ignore missing parallel tests in existing packages
- path: (agreement|catchup|cmd|config|crypto|daemon|data|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test.go
linters:
- paralleltest
# Add all linters here -- Comment this block out for testing linters
- path: test/linttest/lintissues\.go
linters:
Expand Down
4 changes: 1 addition & 3 deletions data/transactions/logic/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2800,10 +2800,8 @@ func TestGetSpec(t *testing.T) {
require.Equal(t, "unknown opcode: nonsense", ops.Errors[1].Err.Error())
}

func TestAddPseudoDocTags(t *testing.T) {
func TestAddPseudoDocTags(t *testing.T) { //nolint:paralleltest // Not parallel because it modifies pseudoOps and opDocByName which are global maps
partitiontest.PartitionTest(t)
// Not parallel because it modifies pseudoOps and opDocByName which are global maps
// t.Parallel()
defer func() {
delete(pseudoOps, "tests")
delete(opDocByName, "multiple")
Expand Down
8 changes: 2 additions & 6 deletions data/transactions/logic/evalAppTxn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1761,9 +1761,7 @@ int 1
`

for _, unified := range []bool{true, false} {
t.Run(fmt.Sprintf("unified=%t", unified), func(t *testing.T) {
// t.Parallel() NO! unified variable is actually shared

t.Run(fmt.Sprintf("unified=%t", unified), func(t *testing.T) { //nolint:paralleltest // NO t.Parallel(). unified variable is actually shared
ep, parentTx, ledger := MakeSampleEnv()
ep.Proto.UnifyInnerTxIDs = unified

Expand Down Expand Up @@ -2226,10 +2224,8 @@ func TestInnerTxIDCaching(t *testing.T) {
parentAppID := basics.AppIndex(888)
childAppID := basics.AppIndex(222)

for _, unified := range []bool{true, false} {
for _, unified := range []bool{true, false} { //nolint:paralleltest // NO t.Parallel(). unified variable is actually shared
t.Run(fmt.Sprintf("unified=%t", unified), func(t *testing.T) {
// t.Parallel() NO! unified variable is actually shared

ep, parentTx, ledger := MakeSampleEnv()
ep.Proto.UnifyInnerTxIDs = unified

Expand Down

0 comments on commit 7f94674

Please sign in to comment.