Skip to content

Commit afe1c6f

Browse files
committed
internal/lsp/regtest: remove calls to t.Parallel()
Originally I decided to use t.Parallel() in hopes of uncovering new bugs. That may have worked... but manifested as rare flakes that are difficult to diagnose (golang.org/issues/37318). Since this level of parallelism is extremely unlikely in normal gopls workloads, I'm going to remove the t.Parallel() calls in hopes of eliminating this flakiness. I'd rather be able to continue running these tests. Also, don't run in the 'Shared' execution mode by default: normal gopls execution is either as a sidecar (the Singleton execution mode), or as a daemon (the Forwarded execution mode). Un-skip the TestGoToStdlibDefinition test, as hopefully it will no longer flake. Updates golang/go#37318. Change-Id: Id73ee3c8702ab4ab1d039baa038fbce879e38df8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/221379 Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 204d844 commit afe1c6f

File tree

4 files changed

+1
-11
lines changed

4 files changed

+1
-11
lines changed

internal/lsp/regtest/definition_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const message = "Hello World."
3232
`
3333

3434
func TestGoToInternalDefinition(t *testing.T) {
35-
t.Parallel()
3635
runner.Run(t, internalDefinition, func(ctx context.Context, t *testing.T, env *Env) {
3736
env.OpenFile("main.go")
3837
name, pos := env.GoToDefinition("main.go", fake.Pos{Line: 5, Column: 13})
@@ -63,8 +62,6 @@ func main() {
6362
}`
6463

6564
func TestGoToStdlibDefinition(t *testing.T) {
66-
t.Skip("skipping due to golang.org/issues/37318")
67-
t.Parallel()
6865
runner.Run(t, stdlibDefinition, func(ctx context.Context, t *testing.T, env *Env) {
6966
env.OpenFile("main.go")
7067
name, pos := env.GoToDefinition("main.go", fake.Pos{Line: 8, Column: 19})

internal/lsp/regtest/diagnostics_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func main() {
2626
}`
2727

2828
func TestDiagnosticErrorInEditedFile(t *testing.T) {
29-
t.Parallel()
3029
runner.Run(t, exampleProgram, func(ctx context.Context, t *testing.T, env *Env) {
3130
// Deleting the 'n' at the end of Println should generate a single error
3231
// diagnostic.
@@ -43,7 +42,6 @@ const Foo = "abc
4342
`
4443

4544
func TestDiagnosticErrorInNewFile(t *testing.T) {
46-
t.Parallel()
4745
runner.Run(t, brokenFile, func(ctx context.Context, t *testing.T, env *Env) {
4846
env.CreateBuffer("broken.go", brokenFile)
4947
env.Await(DiagnosticAt("broken.go", 2, 12))
@@ -67,7 +65,6 @@ const a = 2
6765
`
6866

6967
func TestDiagnosticClearingOnEdit(t *testing.T) {
70-
t.Parallel()
7168
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
7269
env.OpenFile("b.go")
7370
env.Await(DiagnosticAt("a.go", 2, 6), DiagnosticAt("b.go", 2, 6))
@@ -80,7 +77,6 @@ func TestDiagnosticClearingOnEdit(t *testing.T) {
8077
}
8178

8279
func TestDiagnosticClearingOnDelete(t *testing.T) {
83-
t.Parallel()
8480
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
8581
env.OpenFile("a.go")
8682
env.Await(DiagnosticAt("a.go", 2, 6), DiagnosticAt("b.go", 2, 6))
@@ -91,7 +87,6 @@ func TestDiagnosticClearingOnDelete(t *testing.T) {
9187
}
9288

9389
func TestDiagnosticClearingOnClose(t *testing.T) {
94-
t.Parallel()
9590
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
9691
env.CreateBuffer("c.go", `package consts
9792

internal/lsp/regtest/env.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const (
4141
// it.
4242
SeparateProcess
4343
// NormalModes runs tests in all modes.
44-
NormalModes = Singleton | Shared | Forwarded
44+
NormalModes = Singleton | Forwarded
4545
)
4646

4747
// A Runner runs tests in gopls execution environments, as specified by its

internal/lsp/regtest/shared_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func runShared(t *testing.T, program string, testFunc func(ctx context.Context,
3737
}
3838

3939
func TestSimultaneousEdits(t *testing.T) {
40-
t.Parallel()
4140
runShared(t, exampleProgram, func(ctx context.Context, t *testing.T, env1 *Env, env2 *Env) {
4241
// In editor #1, break fmt.Println as before.
4342
edit1 := fake.NewEdit(5, 11, 5, 12, "")
@@ -55,7 +54,6 @@ func TestSimultaneousEdits(t *testing.T) {
5554
}
5655

5756
func TestShutdown(t *testing.T) {
58-
t.Parallel()
5957
runShared(t, sharedProgram, func(ctx context.Context, t *testing.T, env1 *Env, env2 *Env) {
6058
env1.CloseEditor()
6159
// Now make an edit in editor #2 to trigger diagnostics.

0 commit comments

Comments
 (0)