-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
balancergroup: Propagate balancer.BuildOptions to child policies #4184
Conversation
@@ -590,16 +594,20 @@ func (s) TestBalancerGroup_start_close(t *testing.T) { | |||
// whenever it gets an address update. It's expected that start() doesn't block | |||
// because of deadlock. | |||
func (s) TestBalancerGroup_start_close_deadlock(t *testing.T) { | |||
const balancerName = "stub-TestBalancerGroup_start_close_deadlock" | |||
stub.Register(balancerName, stub.BalancerFuncs{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option is to export stub.bb
, and add a NewBB()
. So you don't need to register and get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will send a separate PR for that since I would have to touch other existing call sites as well. Thanks.
|
||
// Send an empty clientConn state change. This should trigger the | ||
// verification of the buildOptions being passed to the child policy. | ||
bg.UpdateClientConnState(testBalancerIDs[0], balancer.ClientConnState{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function not return the error from the stub?
If it does, we don't need ccsCh
, right?
I think balancergroup
calls the methods inline.
Unlike e.g. cluster_manager, where we get errors from bg.UpdateClientConnState
, but we don't aggregate and return that error. So ccsCh
would be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. Done.
API changes:
balancergroup.New()
is modified to takebalancer.BuildOptions
as its second argument.balancer.BuildOptions
is passed to child policies when they are constructed.balancergroup
, it is better to take thebalancer.BuildOptions
as part ofNew()
instead of as part ofAdd()
.Other changes:
clustermanager
,eds
andweightedtarget
LB policies to passbalancer.BuildOptions
to thebalancergroup
.balancer.BuildOptions
are propagated properly.testutils.TestConstBalancerBuilder
and usestub.Balancer
instead.Fixes #4185