Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xds: Use wrr_locality LB and support load_balancing_policy in Cluster #9141

Merged
merged 6 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 5 additions & 27 deletions xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static io.grpc.ConnectivityState.TRANSIENT_FAILURE;
import static io.grpc.xds.XdsLbPolicies.PRIORITY_POLICY_NAME;
import static io.grpc.xds.XdsLbPolicies.WEIGHTED_TARGET_POLICY_NAME;

import com.google.common.annotations.VisibleForTesting;
import io.grpc.Attributes;
Expand Down Expand Up @@ -49,8 +48,6 @@
import io.grpc.xds.EnvoyServerProtoData.UpstreamTlsContext;
import io.grpc.xds.PriorityLoadBalancerProvider.PriorityLbConfig;
import io.grpc.xds.PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig;
import io.grpc.xds.WeightedTargetLoadBalancerProvider.WeightedPolicySelection;
import io.grpc.xds.WeightedTargetLoadBalancerProvider.WeightedTargetConfig;
import io.grpc.xds.XdsClient.EdsResourceWatcher;
import io.grpc.xds.XdsClient.EdsUpdate;
import io.grpc.xds.XdsLogger.XdsLogLevel;
Expand Down Expand Up @@ -155,6 +152,7 @@ private final class ClusterResolverLbState extends LoadBalancer {
private final Helper helper;
private final List<String> clusters = new ArrayList<>();
private final Map<String, ClusterState> clusterStates = new HashMap<>();
private final Map<Locality, Integer> localityWeights = new HashMap<>();
private PolicySelection endpointLbPolicy;
private ResolvedAddresses resolvedAddresses;
private LoadBalancer childLb;
Expand Down Expand Up @@ -249,6 +247,8 @@ private void handleEndpointResourceUpdate() {
resolvedAddresses.toBuilder()
.setLoadBalancingPolicyConfig(childConfig)
.setAddresses(Collections.unmodifiableList(addresses))
.setAttributes(resolvedAddresses.getAttributes().toBuilder()
.set(InternalXdsAttributes.ATTR_LOCALITY_WEIGHTS, localityWeights).build())
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
.build());
}

Expand Down Expand Up @@ -409,6 +409,7 @@ public void run() {
"Discard locality {0} with 0 healthy endpoints", locality);
continue;
}
localityWeights.put(locality, localityLbInfo.localityWeight());
ejona86 marked this conversation as resolved.
Show resolved Hide resolved
if (!prioritizedLocalityWeights.containsKey(priorityName)) {
prioritizedLocalityWeights.put(priorityName, new HashMap<Locality, Integer>());
}
Expand Down Expand Up @@ -686,32 +687,9 @@ private static Map<String, PriorityChildConfig> generateEdsBasedPriorityChildCon
List<DropOverload> dropOverloads) {
Map<String, PriorityChildConfig> configs = new HashMap<>();
for (String priority : prioritizedLocalityWeights.keySet()) {
PolicySelection leafPolicy = endpointLbPolicy;
// Depending on the endpoint-level load balancing policy, different LB hierarchy may be
// created. If the endpoint-level LB policy is round_robin or least_request_experimental,
// it creates a two-level LB hierarchy: a locality-level LB policy that balances load
// according to locality weights followed by an endpoint-level LB policy that balances load
// between endpoints within the locality. If the endpoint-level LB policy is
// ring_hash_experimental, it creates a unified LB policy that balances load by weighing the
// product of each endpoint's weight and the weight of the locality it belongs to.
if (endpointLbPolicy.getProvider().getPolicyName().equals("round_robin")
|| endpointLbPolicy.getProvider().getPolicyName().equals("least_request_experimental")) {
Map<Locality, Integer> localityWeights = prioritizedLocalityWeights.get(priority);
Map<String, WeightedPolicySelection> targets = new HashMap<>();
for (Locality locality : localityWeights.keySet()) {
int weight = localityWeights.get(locality);
WeightedPolicySelection target = new WeightedPolicySelection(weight, endpointLbPolicy);
targets.put(localityName(locality), target);
}
LoadBalancerProvider weightedTargetLbProvider =
lbRegistry.getProvider(WEIGHTED_TARGET_POLICY_NAME);
WeightedTargetConfig weightedTargetConfig =
new WeightedTargetConfig(Collections.unmodifiableMap(targets));
leafPolicy = new PolicySelection(weightedTargetLbProvider, weightedTargetConfig);
}
ClusterImplConfig clusterImplConfig =
new ClusterImplConfig(cluster, edsServiceName, lrsServerInfo, maxConcurrentRequests,
dropOverloads, leafPolicy, tlsContext);
dropOverloads, endpointLbPolicy, tlsContext);
LoadBalancerProvider clusterImplLbProvider =
lbRegistry.getProvider(XdsLbPolicies.CLUSTER_IMPL_POLICY_NAME);
PolicySelection clusterImplPolicy =
Expand Down
16 changes: 13 additions & 3 deletions xds/src/main/java/io/grpc/xds/LegacyLoadBalancerConfigFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.grpc.xds;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.envoyproxy.envoy.config.cluster.v3.Cluster;
import io.envoyproxy.envoy.config.cluster.v3.Cluster.LeastRequestLbConfig;
Expand All @@ -38,6 +39,9 @@ abstract class LegacyLoadBalancerConfigFactory {
static final String LEAST_REQUEST_FIELD_NAME = "least_request_experimental";
static final String CHOICE_COUNT_FIELD_NAME = "choiceCount";

static final String WRR_LOCALITY_FIELD_NAME = "wrr_locality_experimental";
static final String CHILD_POLICY_FIELD = "childPolicy";

/**
* Factory method for creating a new {link LoadBalancerConfigConverter} for a given xDS {@link
* Cluster}.
Expand All @@ -47,13 +51,13 @@ abstract class LegacyLoadBalancerConfigFactory {
static ImmutableMap<String, ?> newConfig(Cluster cluster, boolean enableLeastRequest)
throws ResourceInvalidException {
switch (cluster.getLbPolicy()) {
case ROUND_ROBIN:
return newRoundRobinConfig();
case RING_HASH:
return newRingHashConfig(cluster);
case ROUND_ROBIN:
return newWrrLocalityConfig(newRoundRobinConfig());
case LEAST_REQUEST:
if (enableLeastRequest) {
return newLeastRequestConfig(cluster);
return newWrrLocalityConfig(newLeastRequestConfig(cluster));
}
break;
default:
Expand All @@ -62,6 +66,12 @@ abstract class LegacyLoadBalancerConfigFactory {
"Cluster " + cluster.getName() + ": unsupported lb policy: " + cluster.getLbPolicy());
}

private static ImmutableMap<String, ?> newWrrLocalityConfig(
ImmutableMap<String, ?> childConfig) {
return ImmutableMap.<String, Object>builder().put(WRR_LOCALITY_FIELD_NAME,
ImmutableMap.of(CHILD_POLICY_FIELD, ImmutableList.of(childConfig))).build();
}

// Builds an empty configuration for round robin (it is not configurable).
private static ImmutableMap<String, ?> newRoundRobinConfig() {
return ImmutableMap.of(ROUND_ROBIN_FIELD_NAME, ImmutableMap.of());
Expand Down
6 changes: 5 additions & 1 deletion xds/src/test/java/io/grpc/xds/ClientXdsClientDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,11 @@ public void parseCluster_leastRequestLbPolicy_defaultLbConfig() throws ResourceI
cluster, new HashSet<String>(), null, LRS_SERVER_INFO,
LoadBalancerRegistry.getDefaultRegistry());
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(update.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("least_request_experimental");
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
temawi marked this conversation as resolved.
Show resolved Hide resolved
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("least_request_experimental");
}

@Test
Expand Down
93 changes: 69 additions & 24 deletions xds/src/test/java/io/grpc/xds/ClientXdsClientTestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,12 @@ public void cdsResourceFound() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -1651,8 +1655,12 @@ public void wrappedCdsResource() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand Down Expand Up @@ -1680,8 +1688,12 @@ public void cdsResourceFound_leastRequestLbPolicy() {
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("least_request_experimental");
assertThat(lbConfig.getRawConfigValue().get("choiceCount")).isEqualTo(3);
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("least_request_experimental");
assertThat(childConfigs.get(0).getRawConfigValue().get("choiceCount")).isEqualTo(3);
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand Down Expand Up @@ -1736,8 +1748,12 @@ public void cdsResponseWithAggregateCluster() {
CdsUpdate cdsUpdate = cdsUpdateCaptor.getValue();
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.AGGREGATE);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.prioritizedClusterNames()).containsExactlyElementsIn(candidates).inOrder();
verifyResourceMetadataAcked(CDS, CDS_RESOURCE, clusterAggregate, VERSION_1, TIME_INCREMENT);
verifySubscribedResourcesMetadataSizes(0, 1, 0, 0);
Expand All @@ -1758,8 +1774,12 @@ public void cdsResponseWithCircuitBreakers() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isEqualTo(200L);
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand Down Expand Up @@ -1903,8 +1923,12 @@ public void cachedCdsResource_data() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -1929,6 +1953,7 @@ public void cachedCdsResource_absent() {
}

@Test
@SuppressWarnings("unchecked")
public void cdsResourceUpdated() {
DiscoveryRpcCall call = startResourceWatcher(CDS, CDS_RESOURCE, cdsResourceWatcher);
verifyResourceMetadataRequested(CDS, CDS_RESOURCE);
Expand All @@ -1946,8 +1971,11 @@ public void cdsResourceUpdated() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.LOGICAL_DNS);
assertThat(cdsUpdate.dnsHostName()).isEqualTo(dnsHostAddr + ":" + dnsHostPort);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -1966,8 +1994,11 @@ public void cdsResourceUpdated() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isEqualTo(edsService);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isEqualTo(lrsServerInfo);
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand Down Expand Up @@ -2035,8 +2066,12 @@ public void cdsResourceDeleted() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isNull();
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
@SuppressWarnings("unchecked")
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -2053,6 +2088,7 @@ public void cdsResourceDeleted() {
}

@Test
@SuppressWarnings("unchecked")
public void multipleCdsWatchers() {
String cdsResourceTwo = "cluster-bar.googleapis.com";
CdsResourceWatcher watcher1 = mock(CdsResourceWatcher.class);
Expand Down Expand Up @@ -2088,8 +2124,11 @@ public void multipleCdsWatchers() {
assertThat(cdsUpdate.clusterName()).isEqualTo(CDS_RESOURCE);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.LOGICAL_DNS);
assertThat(cdsUpdate.dnsHostName()).isEqualTo(dnsHostAddr + ":" + dnsHostPort);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
LbConfig lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
List<LbConfig> childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isNull();
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -2098,8 +2137,11 @@ public void multipleCdsWatchers() {
assertThat(cdsUpdate.clusterName()).isEqualTo(cdsResourceTwo);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isEqualTo(edsService);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isEqualTo(lrsServerInfo);
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand All @@ -2108,8 +2150,11 @@ public void multipleCdsWatchers() {
assertThat(cdsUpdate.clusterName()).isEqualTo(cdsResourceTwo);
assertThat(cdsUpdate.clusterType()).isEqualTo(ClusterType.EDS);
assertThat(cdsUpdate.edsServiceName()).isEqualTo(edsService);
assertThat(ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig())
.getPolicyName()).isEqualTo("round_robin");
lbConfig = ServiceConfigUtil.unwrapLoadBalancingConfig(cdsUpdate.lbPolicyConfig());
assertThat(lbConfig.getPolicyName()).isEqualTo("wrr_locality_experimental");
childConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(
(List<Map<String, ?>>) lbConfig.getRawConfigValue().get("childPolicy"));
assertThat(childConfigs.get(0).getPolicyName()).isEqualTo("round_robin");
assertThat(cdsUpdate.lrsServerInfo()).isEqualTo(lrsServerInfo);
assertThat(cdsUpdate.maxConcurrentRequests()).isNull();
assertThat(cdsUpdate.upstreamTlsContext()).isNull();
Expand Down
Loading