Skip to content

Commit ad9b1b3

Browse files
committed
in-progress changes.
1 parent f038f4c commit ad9b1b3

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,11 @@ public void discoverTopLevelEdsCluster() {
247247
assertThat(childBalancer.name).isEqualTo(CLUSTER_RESOLVER_POLICY_NAME);
248248
ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
249249
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
250-
Arrays.asList(
251-
DiscoveryMechanism.forEds(
252-
CLUSTER, EDS_SERVICE_NAME, lrsServerInfo, 100L, upstreamTlsContext,
253-
Collections.emptyMap(), io.grpc.xds.EnvoyServerProtoData.OutlierDetection.create(
254-
null, null, null, null, SuccessRateEjection.create(null, null, null, null),
255-
FailurePercentageEjection.create(null, null, null, null)))));
250+
DiscoveryMechanism.forEds(
251+
CLUSTER, EDS_SERVICE_NAME, lrsServerInfo, 100L, upstreamTlsContext,
252+
Collections.emptyMap(), io.grpc.xds.EnvoyServerProtoData.OutlierDetection.create(
253+
null, null, null, null, SuccessRateEjection.create(null, null, null, null),
254+
FailurePercentageEjection.create(null, null, null, null))));
256255
assertThat(
257256
GracefulSwitchLoadBalancerAccessor.getChildProvider(childLbConfig.lbConfig).getPolicyName())
258257
.isEqualTo("wrr_locality_experimental");
@@ -297,10 +296,9 @@ public void discoverTopLevelLogicalDnsCluster() {
297296
assertThat(childBalancer.name).isEqualTo(CLUSTER_RESOLVER_POLICY_NAME);
298297
ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
299298
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
300-
Arrays.asList(
301-
DiscoveryMechanism.forLogicalDns(
302-
CLUSTER, "dns.example.com:1111", lrsServerInfo, 100L, upstreamTlsContext,
303-
Collections.emptyMap())));
299+
DiscoveryMechanism.forLogicalDns(
300+
CLUSTER, "dns.example.com:1111", lrsServerInfo, 100L, upstreamTlsContext,
301+
Collections.emptyMap()));
304302
assertThat(
305303
GracefulSwitchLoadBalancerAccessor.getChildProvider(childLbConfig.lbConfig).getPolicyName())
306304
.isEqualTo("wrr_locality_experimental");
@@ -333,9 +331,8 @@ public void nonAggregateCluster_resourceUpdate() {
333331
FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers);
334332
ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
335333
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
336-
Arrays.asList(
337334
DiscoveryMechanism.forEds(
338-
CLUSTER, EDS_SERVICE_NAME, null, 100L, null, Collections.emptyMap(), null)));
335+
CLUSTER, EDS_SERVICE_NAME, null, 100L, null, Collections.emptyMap(), null));
339336

340337
cluster = EDS_CLUSTER.toBuilder()
341338
.setCircuitBreakers(CircuitBreakers.newBuilder()
@@ -349,9 +346,8 @@ public void nonAggregateCluster_resourceUpdate() {
349346
childBalancer = Iterables.getOnlyElement(childBalancers);
350347
childLbConfig = (ClusterResolverConfig) childBalancer.config;
351348
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
352-
Arrays.asList(
353349
DiscoveryMechanism.forEds(
354-
CLUSTER, EDS_SERVICE_NAME, null, 200L, null, Collections.emptyMap(), null)));
350+
CLUSTER, EDS_SERVICE_NAME, null, 200L, null, Collections.emptyMap(), null));
355351
}
356352

357353
@Test
@@ -364,9 +360,8 @@ public void nonAggregateCluster_resourceRevoked() {
364360
FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers);
365361
ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
366362
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
367-
Arrays.asList(
368363
DiscoveryMechanism.forEds(
369-
CLUSTER, EDS_SERVICE_NAME, null, null, null, Collections.emptyMap(), null)));
364+
CLUSTER, EDS_SERVICE_NAME, null, null, null, Collections.emptyMap(), null));
370365

371366
controlPlaneService.setXdsConfig(ADS_TYPE_URL_CDS, ImmutableMap.of());
372367

@@ -396,9 +391,8 @@ public void dynamicCluster() {
396391
FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers);
397392
ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
398393
assertThat(childLbConfig.discoveryMechanism).isEqualTo(
399-
Arrays.asList(
400394
DiscoveryMechanism.forEds(
401-
clusterName, EDS_SERVICE_NAME, null, null, null, Collections.emptyMap(), null)));
395+
clusterName, EDS_SERVICE_NAME, null, null, null, Collections.emptyMap(), null));
402396

403397
assertThat(this.lastXdsConfig.getClusters()).containsKey(clusterName);
404398
shutdownLoadBalancer();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ public void onlyEdsClusters_resourceNeverExist_returnErrorPicker() {
679679
}
680680

681681
@Test
682-
public void edsCluster_allResourcesRevoked_shutDownChildLbPolicy() {
682+
public void edsCluster_resourcesRevoked_shutDownChildLbPolicy() {
683683
ClusterResolverConfig config = new ClusterResolverConfig(
684684
edsDiscoveryMechanism1, roundRobin, false);
685685
deliverLbConfig(config);
@@ -699,11 +699,11 @@ public void edsCluster_allResourcesRevoked_shutDownChildLbPolicy() {
699699
assertThat(((PriorityLbConfig) childBalancer.config).priorities).hasSize(1);
700700
assertAddressesEqual(Arrays.asList(endpoint1), childBalancer.addresses);
701701

702-
xdsClient.deliverResourceNotFound(EDS_SERVICE_NAME2);
702+
xdsClient.deliverResourceNotFound(EDS_SERVICE_NAME1);
703703
verify(helper).updateBalancingState(
704704
eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture());
705705
Status expectedError = Status.UNAVAILABLE.withDescription(
706-
"No usable endpoint from cluster(s): " + Arrays.asList(CLUSTER1, CLUSTER2));
706+
"No usable endpoint from cluster(s): " + Arrays.asList(CLUSTER1));
707707
assertPicker(pickerCaptor.getValue(), expectedError, null);
708708
}
709709

@@ -986,8 +986,8 @@ public void resolutionErrorAfterChildLbCreated_propagateError() {
986986

987987
xdsClient.deliverError(Status.RESOURCE_EXHAUSTED.withDescription("out of memory"));
988988
assertThat(childBalancer.upstreamError).isNotNull(); // last cluster's (DNS) error propagated
989-
assertThat(childBalancer.upstreamError.getCode()).isEqualTo(Code.UNKNOWN);
990-
assertThat(childBalancer.upstreamError.getDescription()).isEqualTo("I am lost");
989+
assertThat(childBalancer.upstreamError.getCode()).isEqualTo(Code.UNAVAILABLE);
990+
assertThat(childBalancer.upstreamError.getDescription()).isEqualTo("Unable to load EDS backend-service-foo.googleapis.com. xDS server returned: RESOURCE_EXHAUSTED: out of memory");
991991
assertThat(childBalancer.shutdown).isFalse();
992992
verify(helper, never()).updateBalancingState(
993993
eq(ConnectivityState.TRANSIENT_FAILURE), any(SubchannelPicker.class));

0 commit comments

Comments
 (0)