internal/lsp/regtest: remove arbitrary timeout for closing the editor

Following up on some post-submit feedback in CL 417583.

Fixes golang/go#53819

Change-Id: Iebb1e6496ab1d6fde8961d8617d0b63e19c7033b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/419503
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Robert Findley 2022-07-27 14:57:02 -04:00
parent d01bb2ff91
commit 8ea5687987
1 changed files with 5 additions and 7 deletions

View File

@ -391,13 +391,11 @@ func (r *Runner) Run(t *testing.T, files string, test TestFunc, opts ...RunOptio
// For tests that failed due to a timeout, don't fail to shutdown
// because ctx is done.
//
// golang/go#53820: now that we await the completion of ongoing work in
// shutdown, we must allow a significant amount of time for ongoing go
// command invocations to exit.
ctx, cancel := context.WithTimeout(xcontext.Detach(ctx), 30*time.Second)
defer cancel()
if err := env.Editor.Close(ctx); err != nil {
pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
// There is little point to setting an arbitrary timeout for closing
// the editor: in general we want to clean up before proceeding to the
// next test, and if there is a deadlock preventing closing it will
// eventually be handled by the `go test` timeout.
if err := env.Editor.Close(xcontext.Detach(ctx)); err != nil {
t.Errorf("closing editor: %v", err)
}
}()