xds: fix flaky xds test (#10109)

This commit is contained in:
yifeizhuang 2023-04-28 11:17:49 -07:00 committed by GitHub
parent fbc8679f7a
commit fe53346697
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -3567,11 +3567,10 @@ public abstract class XdsClientImplTestBase {
// Setup xdsClient to fail on stream creation
XdsClientImpl client = createXdsClient("some.garbage");
client.watchXdsResource(XdsListenerResource.getInstance(), LDS_RESOURCE, ldsResourceWatcher);
fakeClock.forwardTime(20, TimeUnit.SECONDS);
verify(ldsResourceWatcher, Mockito.timeout(5000).times(1)).onError(ArgumentMatchers.any());
fakeClock.forwardTime(50, TimeUnit.SECONDS); // Trigger rpcRetry if appropriate
assertThat(fakeClock.getPendingTasks(LDS_RESOURCE_FETCH_TIMEOUT_TASK_FILTER)).isEmpty();
assertThat(fakeClock.numPendingTasks()).isEqualTo(1); //retry
assertThat(fakeClock.getPendingTasks().iterator().next().toString().contains("RpcRetryTask"))
.isTrue();
client.shutdown();
}