test: Allow fix tests to run concurrently (#1576)

This commit is contained in:
Andrew Shannon Brown 2021-02-20 07:38:39 -08:00 committed by GitHub
parent f00da2c0b7
commit eace6a11a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,9 @@ func TestFix(t *testing.T) {
if os.Getenv("GL_KEEP_TEMP_FILES") == "1" { if os.Getenv("GL_KEEP_TEMP_FILES") == "1" {
t.Logf("Temp dir for fix test: %s", tmpDir) t.Logf("Temp dir for fix test: %s", tmpDir)
} else { } else {
defer os.RemoveAll(tmpDir) t.Cleanup(func() {
os.RemoveAll(tmpDir)
})
} }
fixDir := filepath.Join(testdataDir, "fix") fixDir := filepath.Join(testdataDir, "fix")
@ -38,9 +40,11 @@ func TestFix(t *testing.T) {
for _, input := range inputs { for _, input := range inputs {
input := input input := input
t.Run(filepath.Base(input), func(t *testing.T) { t.Run(filepath.Base(input), func(t *testing.T) {
t.Parallel()
args := []string{ args := []string{
"--disable-all", "--print-issued-lines=false", "--print-linter-name=false", "--out-format=line-number", "--disable-all", "--print-issued-lines=false", "--print-linter-name=false", "--out-format=line-number",
"--fix", "--allow-parallel-runners", "--fix",
input, input,
} }
rc := extractRunContextFromComments(t, input) rc := extractRunContextFromComments(t, input)