Skip to content

Commit dd752d6

Browse files
francisco3ferrazadonovan
authored andcommitted
gopls/internal/test/integration/completion: fix flaky TestUnimportedCompletion_VSCodeIssue3365
The test used nested t.Run() subtests inside a runner.Run callback. Env methods called e.TB.Fatal() on the parent subtest's t from within a child subtest goroutine, causing "FailNow on a parent test" panics and 20-minute timeouts. Replace the inner t.Run() subtests with a plain loop. Fixes golang/go#77756 Change-Id: I37e1c77606981665bdb762316da3b02b5c6505fc Reviewed-on: https://go-review.googlesource.com/c/tools/+/748620 Reviewed-by: Alan Donovan <adonovan@google.com> Commit-Queue: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Madeline Kalil <mkalil@google.com>
1 parent a5d96d4 commit dd752d6

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

gopls/internal/test/integration/completion/completion_test.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -706,20 +706,17 @@ var Lower = ""
706706
}
707707

708708
for _, tc := range testcases {
709-
t.Run(fmt.Sprintf("%v/%v", tc.mode, tc.accept), func(t *testing.T) {
710-
t.Logf("mode=%q accept=%q", tc.mode, tc.accept)
711-
712-
env.SetSuggestionInsertReplaceMode(tc.mode == "replace")
713-
env.SetBufferContent("main.go", orig)
714-
loc := env.RegexpSearch("main.go", `()Lower\)`)
715-
completions := env.Completion(loc)
716-
item := find(t, completions, tc.accept)
717-
env.AcceptCompletion(loc, item)
718-
got := env.BufferText("main.go")
719-
if !strings.Contains(got, tc.want) {
720-
t.Errorf("unexpected state after completion:\n%v\nwanted %v", got, tc.want)
721-
}
722-
})
709+
t.Logf("mode=%q accept=%q", tc.mode, tc.accept)
710+
env.SetSuggestionInsertReplaceMode(tc.mode == "replace")
711+
env.SetBufferContent("main.go", orig)
712+
loc := env.RegexpSearch("main.go", `()Lower\)`)
713+
completions := env.Completion(loc)
714+
item := find(t, completions, tc.accept)
715+
env.AcceptCompletion(loc, item)
716+
got := env.BufferText("main.go")
717+
if !strings.Contains(got, tc.want) {
718+
t.Errorf("unexpected state after completion:\n%v\nwanted %v", got, tc.want)
719+
}
723720
}
724721
})
725722
})

0 commit comments

Comments
 (0)