Skip to content

Commit 9c596af

Browse files
committed
Allow fix tests to run concurrently
Ensure cleanup doesn't happen until after all tests are done. Also don't require holding a lock since files are not shared between tests.
1 parent be02979 commit 9c596af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/fix_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ func TestFix(t *testing.T) {
2727
if os.Getenv("GL_KEEP_TEMP_FILES") == "1" {
2828
t.Logf("Temp dir for fix test: %s", tmpDir)
2929
} else {
30-
defer os.RemoveAll(tmpDir)
30+
t.Cleanup(func() {
31+
os.RemoveAll(tmpDir)
32+
})
3133
}
3234

3335
fixDir := filepath.Join(testdataDir, "fix")
@@ -38,9 +40,10 @@ func TestFix(t *testing.T) {
3840
for _, input := range inputs {
3941
input := input
4042
t.Run(filepath.Base(input), func(t *testing.T) {
43+
t.Parallel()
4144
args := []string{
4245
"--disable-all", "--print-issued-lines=false", "--print-linter-name=false", "--out-format=line-number",
43-
"--fix",
46+
"--allow-parallel-runners", "--fix",
4447
input,
4548
}
4649
rc := extractRunContextFromComments(t, input)

0 commit comments

Comments
 (0)