1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:14:46 -07:00

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 <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rob Findley 2020-02-27 12:31:02 -05:00 committed by Robert Findley
parent 204d844ad4
commit afe1c6fc1b
4 changed files with 1 additions and 11 deletions

View File

@ -32,7 +32,6 @@ const message = "Hello World."
`
func TestGoToInternalDefinition(t *testing.T) {
t.Parallel()
runner.Run(t, internalDefinition, func(ctx context.Context, t *testing.T, env *Env) {
env.OpenFile("main.go")
name, pos := env.GoToDefinition("main.go", fake.Pos{Line: 5, Column: 13})
@ -63,8 +62,6 @@ func main() {
}`
func TestGoToStdlibDefinition(t *testing.T) {
t.Skip("skipping due to golang.org/issues/37318")
t.Parallel()
runner.Run(t, stdlibDefinition, func(ctx context.Context, t *testing.T, env *Env) {
env.OpenFile("main.go")
name, pos := env.GoToDefinition("main.go", fake.Pos{Line: 8, Column: 19})

View File

@ -26,7 +26,6 @@ func main() {
}`
func TestDiagnosticErrorInEditedFile(t *testing.T) {
t.Parallel()
runner.Run(t, exampleProgram, func(ctx context.Context, t *testing.T, env *Env) {
// Deleting the 'n' at the end of Println should generate a single error
// diagnostic.
@ -43,7 +42,6 @@ const Foo = "abc
`
func TestDiagnosticErrorInNewFile(t *testing.T) {
t.Parallel()
runner.Run(t, brokenFile, func(ctx context.Context, t *testing.T, env *Env) {
env.CreateBuffer("broken.go", brokenFile)
env.Await(DiagnosticAt("broken.go", 2, 12))
@ -67,7 +65,6 @@ const a = 2
`
func TestDiagnosticClearingOnEdit(t *testing.T) {
t.Parallel()
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
env.OpenFile("b.go")
env.Await(DiagnosticAt("a.go", 2, 6), DiagnosticAt("b.go", 2, 6))
@ -80,7 +77,6 @@ func TestDiagnosticClearingOnEdit(t *testing.T) {
}
func TestDiagnosticClearingOnDelete(t *testing.T) {
t.Parallel()
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
env.OpenFile("a.go")
env.Await(DiagnosticAt("a.go", 2, 6), DiagnosticAt("b.go", 2, 6))
@ -91,7 +87,6 @@ func TestDiagnosticClearingOnDelete(t *testing.T) {
}
func TestDiagnosticClearingOnClose(t *testing.T) {
t.Parallel()
runner.Run(t, badPackage, func(ctx context.Context, t *testing.T, env *Env) {
env.CreateBuffer("c.go", `package consts

View File

@ -41,7 +41,7 @@ const (
// it.
SeparateProcess
// NormalModes runs tests in all modes.
NormalModes = Singleton | Shared | Forwarded
NormalModes = Singleton | Forwarded
)
// A Runner runs tests in gopls execution environments, as specified by its

View File

@ -37,7 +37,6 @@ func runShared(t *testing.T, program string, testFunc func(ctx context.Context,
}
func TestSimultaneousEdits(t *testing.T) {
t.Parallel()
runShared(t, exampleProgram, func(ctx context.Context, t *testing.T, env1 *Env, env2 *Env) {
// In editor #1, break fmt.Println as before.
edit1 := fake.NewEdit(5, 11, 5, 12, "")
@ -55,7 +54,6 @@ func TestSimultaneousEdits(t *testing.T) {
}
func TestShutdown(t *testing.T) {
t.Parallel()
runShared(t, sharedProgram, func(ctx context.Context, t *testing.T, env1 *Env, env2 *Env) {
env1.CloseEditor()
// Now make an edit in editor #2 to trigger diagnostics.