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: Properly assign picker. #9201

Merged
merged 2 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* looks for an "rpc_behavior" field in its configuration and includes the value in the
* "rpc-behavior" metadata entry that is sent to the server. This will cause the test server to
* behave in a predefined way. Endpoint picking logic is delegated to the
* {@link PickFirstLoadBalancer}.
* {@link RoundRobinLoadBalancer}.
*
* <p>Initial use case is to prove that a custom load balancer can be configured by the control
* plane via xDS. An interop test will configure this LB and then verify it has been correctly
Expand All @@ -61,9 +61,10 @@ public ConfigOrError parseLoadBalancingPolicyConfig(Map<String, ?> rawLoadBalanc

@Override
public LoadBalancer newLoadBalancer(Helper helper) {
return new RpcBehaviorLoadBalancer(helper,
RpcBehaviorHelper rpcBehaviorHelper = new RpcBehaviorHelper(helper);
return new RpcBehaviorLoadBalancer(rpcBehaviorHelper,
LoadBalancerRegistry.getDefaultRegistry().getProvider("round_robin")
.newLoadBalancer(helper));
.newLoadBalancer(rpcBehaviorHelper));
}

@Override
Expand Down Expand Up @@ -99,8 +100,8 @@ static class RpcBehaviorLoadBalancer extends ForwardingLoadBalancer {
private final RpcBehaviorHelper helper;
private final LoadBalancer delegateLb;

RpcBehaviorLoadBalancer(Helper helper, LoadBalancer delegateLb) {
this.helper = new RpcBehaviorHelper(helper);
RpcBehaviorLoadBalancer(RpcBehaviorHelper helper, LoadBalancer delegateLb) {
this.helper = helper;
this.delegateLb = delegateLb;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void parseInvalidConfig() {

@Test
public void handleResolvedAddressesDelegated() {
RpcBehaviorLoadBalancer lb = new RpcBehaviorLoadBalancer(mockHelper, mockDelegateLb);
RpcBehaviorLoadBalancer lb = new RpcBehaviorLoadBalancer(new RpcBehaviorHelper(mockHelper),
mockDelegateLb);
ResolvedAddresses resolvedAddresses = buildResolvedAddresses(buildConfig());
lb.handleResolvedAddresses(resolvedAddresses);
verify(mockDelegateLb).handleResolvedAddresses(resolvedAddresses);
Expand Down