xds: fixed unsupported unsigned 32 bits issue for circuit breaker (#1… · grpc/grpc-java@f8f6139

@@ -4001,6 +4001,25 @@ public void sendToBadUrl() throws Exception {

40014001

client.shutdown();

40024002

}

400340034004+

@Test

4005+

public void circuitBreakingConversionOf32bitIntTo64bitLongForMaxRequestNegativeValue() {

4006+

DiscoveryRpcCall call = startResourceWatcher(XdsClusterResource.getInstance(), CDS_RESOURCE,

4007+

cdsResourceWatcher);

4008+

Any clusterCircuitBreakers = Any.pack(

4009+

mf.buildEdsCluster(CDS_RESOURCE, null, "round_robin", null, null, false, null,

4010+

"envoy.transport_sockets.tls", mf.buildCircuitBreakers(50, -1), null));

4011+

call.sendResponse(CDS, clusterCircuitBreakers, VERSION_1, "0000");

4012+4013+

// Client sent an ACK CDS request.

4014+

call.verifyRequest(CDS, CDS_RESOURCE, VERSION_1, "0000", NODE);

4015+

verify(cdsResourceWatcher).onChanged(cdsUpdateCaptor.capture());

4016+

CdsUpdate cdsUpdate = cdsUpdateCaptor.getValue();

4017+4018+

assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);

4019+

assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);

4020+

assertThat(cdsUpdate.maxConcurrentRequests()).isEqualTo(4294967295L);

4021+

}

4022+40044023

@Test

40054024

public void sendToNonexistentServer() throws Exception {

40064025

// Setup xdsClient to fail on stream creation