Skip to content

Commit fa7774c

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/test/integration: reduce flakes in TestTelemetryPrompt
Issue golang/go#71590 describes the likely source of flakiness of TestTelemetryPrompt_Response: the test will flake if the UTC day has changed between the start of TestMain and the start of the test. While we cannot fix this flakiness without a change to x/telemetry, we can significantly reduce it by first causing a file rotation check at the start of the test. For golang/go#68659 Change-Id: I22b6b41ebadbea1f4af0b7d4dc64dbfcf617cefd Reviewed-on: https://go-review.googlesource.com/c/tools/+/647436 Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
1 parent 8baecea commit fa7774c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

gopls/internal/test/integration/misc/prompt_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,19 @@ func main() {
276276
allCounters = []string{acceptanceCounter, declinedCounter, attempt1Counter}
277277
)
278278

279+
// To avoid (but not prevent) the flakes encountered in golang/go#68659, we
280+
// need to perform our first read before starting to increment counters.
281+
//
282+
// ReadCounter checks to see if the counter file needs to be rotated before
283+
// reading. When files are rotated, all previous counts are lost. Calling
284+
// ReadCounter here reduces the window for a flake due to this rotation (the
285+
// file was originally was located during countertest.Open in TestMain).
286+
//
287+
// golang/go#71590 tracks the larger problems with the countertest library.
288+
//
289+
// (The counter name below is arbitrary.)
290+
_, _ = countertest.ReadCounter(counter.New("issue68659"))
291+
279292
// We must increment counters in order for the initial reads below to
280293
// succeed.
281294
//

0 commit comments

Comments
 (0)