From 3fec0d3c6a4e43a9f0c2a2daa2cc572bde59bea3 Mon Sep 17 00:00:00 2001 From: Jacob Daitzman Date: Tue, 25 Oct 2022 14:10:13 -0400 Subject: [PATCH 1/4] Include paralleltest in `golangci` linting --- .golangci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.golangci.yml b/.golangci.yml index 62490feca4..a4e7bd1a3d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,7 @@ linters: - revive - staticcheck - typecheck + - paralleltest severity: default-severity: error From 5a022d654d75845071860da27e1716115173b37a Mon Sep 17 00:00:00 2001 From: Jacob Daitzman Date: Tue, 1 Nov 2022 15:15:08 -0400 Subject: [PATCH 2/4] Fix tests that are explicitly not supposed to be parallel # Conflicts: # data/transactions/logic/assembler_test.go # ledger/internal/eval_blackbox_test.go --- data/transactions/logic/assembler_test.go | 4 +--- data/transactions/logic/evalAppTxn_test.go | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/data/transactions/logic/assembler_test.go b/data/transactions/logic/assembler_test.go index 5da1708b92..d53b6fc16d 100644 --- a/data/transactions/logic/assembler_test.go +++ b/data/transactions/logic/assembler_test.go @@ -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") diff --git a/data/transactions/logic/evalAppTxn_test.go b/data/transactions/logic/evalAppTxn_test.go index ea7bd68855..25a073ba3c 100644 --- a/data/transactions/logic/evalAppTxn_test.go +++ b/data/transactions/logic/evalAppTxn_test.go @@ -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 @@ -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 From 5bbc0b4261102e784cb9df4d211faf5d38dc089f Mon Sep 17 00:00:00 2001 From: Jacob Daitzman Date: Thu, 27 Oct 2022 15:34:22 -0400 Subject: [PATCH 3/4] Disable paralleltest linter in existing packages for now --- .golangci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index a4e7bd1a3d..479854f45b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -116,6 +116,10 @@ issues: # - revive - staticcheck - typecheck + # Ignore missing parallel tests in existing packages + - path: (agreement|catchup|cmd|config|crypto|daemon|data|ledger|logging|network|node|protocol|rpcs|shared|stateproof|test|util).*_test.go + linters: + - paralleltest # Add all linters here -- Comment this block out for testing linters - path: test/linttest/lintissues\.go linters: From 0e01e02ff93986e74840271dbd1154d030d82463 Mon Sep 17 00:00:00 2001 From: Jacob Daitzman Date: Tue, 1 Nov 2022 15:08:20 -0400 Subject: [PATCH 4/4] Disable additional pre-revision packages with paralleltest errors --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 479854f45b..0122edf822 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -117,7 +117,7 @@ issues: - staticcheck - typecheck # Ignore missing parallel tests in existing packages - - path: (agreement|catchup|cmd|config|crypto|daemon|data|ledger|logging|network|node|protocol|rpcs|shared|stateproof|test|util).*_test.go + - 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