@@ -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 (
0 commit comments