De-flake `TelemetryTest` (#7445)

This commit is contained in:
Basil Crow 2022-11-26 07:25:07 -08:00 committed by GitHub
parent 88cabe5999
commit d3d1c88d29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -64,13 +64,21 @@ public class TelemetryTest {
j.jenkins.setNoUsageStatistics(false); // tests usually don't submit this, but we need this
assertEquals("no requests received", 0, counter);
ExtensionList.lookupSingleton(Telemetry.TelemetryReporter.class).doRun();
await().pollInterval(250, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
.until(logger::getMessages, hasItem("Telemetry submission received response 200 for: test-data"));
await().pollInterval(250, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
.until(logger::getMessages, hasItem("Skipping telemetry for 'future' as it is configured to start later"));
await().pollInterval(250, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
.until(logger::getMessages, hasItem("Skipping telemetry for 'past' as it is configured to end in the past"));
await().pollInterval(250, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
.until(logger::getMessages, hasItem("Skipping telemetry for 'empty' as it has no data"));
await().pollInterval(250, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
.until(() -> types, hasItem("test-data"));
assertThat(logger.getMessages(), hasItem("Telemetry submission received response 200 for: test-data"));
assertThat(logger.getMessages(), hasItem("Skipping telemetry for 'future' as it is configured to start later"));
assertThat(logger.getMessages(), hasItem("Skipping telemetry for 'past' as it is configured to end in the past"));
assertThat(logger.getMessages(), hasItem("Skipping telemetry for 'empty' as it has no data"));
assertThat(types, not(hasItem("future")));
assertThat(types, not(hasItem("past")));
assertThat(correlators.size(), is(counter));