go/internal/lsp/regtest
Robert Findley 96d05aa120 gopls/internal/regtest: fix TestFailingDiagnosticClearingOnEdit
This test was asserting immediately on the non-presence of published
diagnostics, and therefore was racing with the diagnostics calculation
pass. Following https://go.dev/cl/420539 this became a flake, because
once gopls has calculated diagnostics for the open event, it will
actually publish empty diagnostics for the opened file.

Update the test to use a OnceMet so that we only evaluate the
expectation once we've finished the diagnostics pass. As a result, the
test deterministically failed, which was fixed by using the
EmptyOrNoDiagnostics expectation.

Fixes golang/go#54271

Change-Id: Id3f220ce44c7996132699a724b6c627f034e367f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/422136
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-09 15:36:31 +00:00
..
doc.go gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
env.go gopls/internal/regtest: fix TestFailingDiagnosticClearingOnEdit 2022-08-09 15:36:31 +00:00
env_test.go gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
expectation.go internal/lsp/cache: register a file watcher for explicit GOWORK values 2022-08-08 18:11:08 +00:00
regtest.go internal/lsp/regtest: improvements for shared execution modes 2022-08-02 18:16:22 +00:00
runner.go gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
wrappers.go internal/lsp: update the broken workspace message to mention go.work 2022-08-08 18:10:56 +00:00