internal/lsp: avoid flake in TestDebouncer
internal/lsp: avoid flake in TestDebouncer

TestDebouncer inherently depends on the timing of events. Specifically,
it can fail if the pause between two subsequent events is more than the
debouncing delay.

When this has proved flaky in the past I just increased the debouncing
delay. However, tests are still occasionally flaking. Rather than just
increase the delay arbitrarily, attempt to make the test more robust by
retrying up to three times if the base assumption (that goroutines are
scheduled within a reasonable amount of time) is not met.

Fixes golang/go#45085

Change-Id: Ifa32e695d64ae4bcfe9600a0413bf6358dff9b7a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/309276
Trust: Robert Findley <9179eee875d1ee628c37fb47d7e749e855ffd21f@google.com>
Run-TryBot: Robert Findley <9179eee875d1ee628c37fb47d7e749e855ffd21f@google.com>
gopls-CI: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
TryBot-Result: Go Bot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Rebecca Stambler <d7cf11e5f299d88ea8348366a9fc4f7c335c3afa@golang.org>

golang/tools,golang/tools,golang/tools,golang/tools,golang/tools