Skip to content

Commit 3779aea

Browse files
committed
Merge branch 'client-watcher-changes-2' of https://github.com/shivaspeaks/grpc-java
2 parents a51ac28 + 2baf738 commit 3779aea

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,9 +4580,15 @@ public void serverFailureMetricReport_forRetryAndBackoff() {
45804580
argThat(status -> status.getCode() == Code.DEADLINE_EXCEEDED));
45814581
rdsWatcherInOrder.verify(rdsResourceWatcher).onAmbientError(
45824582
argThat(status -> status.getCode() == Code.DEADLINE_EXCEEDED));
4583-
// Server Failure metric will not be reported, as stream is closed with an error after receiving
4583+
cdsWatcherInOrder.verify(cdsResourceWatcher).onResourceChanged(
4584+
argThat(statusOr -> !statusOr.hasValue()
4585+
&& statusOr.getStatus().getCode() == Code.DEADLINE_EXCEEDED));
4586+
edsWatcherInOrder.verify(edsResourceWatcher).onResourceChanged(
4587+
argThat(statusOr -> !statusOr.hasValue()
4588+
&& statusOr.getStatus().getCode() == Code.DEADLINE_EXCEEDED));
4589+
// Server Failure metric is now reported, as stream is closed with an error after receiving
45844590
// a response
4585-
verifyServerFailureCount(2, 1, xdsServerInfo.target());
4591+
verifyServerFailureCount(3, 1, xdsServerInfo.target());
45864592

45874593
// Reset backoff sequence and retry after backoff.
45884594
inOrder.verify(backoffPolicyProvider).get();
@@ -4597,7 +4603,7 @@ public void serverFailureMetricReport_forRetryAndBackoff() {
45974603
call.sendError(Status.UNAVAILABLE.asException());
45984604
ldsWatcherInOrder.verify(ldsResourceWatcher).onAmbientError(
45994605
argThat(status -> status.getCode() == Code.UNAVAILABLE));
4600-
verifyServerFailureCount(3, 1, xdsServerInfo.target());
4606+
verifyServerFailureCount(4, 1, xdsServerInfo.target());
46014607

46024608
// Retry after backoff.
46034609
inOrder.verify(backoffPolicy2).nextBackoffNanos();
@@ -4610,12 +4616,10 @@ public void serverFailureMetricReport_forRetryAndBackoff() {
46104616
List<Any> clusters = ImmutableList.of(FAILING_ANY, testClusterRoundRobin);
46114617
call.sendResponse(CDS, clusters, VERSION_1, "0000");
46124618
call.sendCompleted();
4613-
// Server Failure metric will not be reported once again, as stream is closed after receiving a
4614-
// response
4615-
verifyServerFailureCount(3, 1, xdsServerInfo.target());
4619+
// Server Failure metric will not be reported, as stream is closed gracefully.
4620+
verifyServerFailureCount(4, 1, xdsServerInfo.target());
46164621
}
46174622

4618-
46194623
private XdsClientImpl createXdsClient(String serverUri) {
46204624
BootstrapInfo bootstrapInfo = buildBootStrap(serverUri);
46214625
return new XdsClientImpl(

xds/src/test/java/io/grpc/xds/XdsClientFallbackTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,18 +461,14 @@ public XdsTransport create(Bootstrapper.ServerInfo serverInfo) {
461461
public void connect_then_mainServerRestart_fallbackServerdown() {
462462
mainXdsServer.restartXdsServer();
463463
xdsClient = xdsClientPool.getObject();
464-
465464
xdsClient.watchXdsResource(XdsListenerResource.getInstance(), MAIN_SERVER, ldsWatcher);
466465

467466
verify(ldsWatcher, timeout(5000)).onResourceChanged(
468467
argThat(statusOr -> statusOr.hasValue() && statusOr.getValue().equals(
469468
LdsUpdate.forApiListener(MAIN_HTTP_CONNECTION_MANAGER))));
470-
471469
mainXdsServer.getServer().shutdownNow();
472470
fallbackServer.getServer().shutdownNow();
473-
474471
xdsClient.watchXdsResource(XdsClusterResource.getInstance(), CLUSTER_NAME, cdsWatcher);
475-
476472
mainXdsServer.restartXdsServer();
477473

478474
verify(cdsWatcher, timeout(5000)).onResourceChanged(

0 commit comments

Comments
 (0)