-
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
weightedtarget: return erroring picker when no targets are configured #8070
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8070 +/- ##
==========================================
+ Coverage 82.10% 82.18% +0.08%
==========================================
Files 387 387
Lines 39067 39080 +13
==========================================
+ Hits 32076 32118 +42
+ Misses 5662 5639 -23
+ Partials 1329 1323 -6
|
@@ -323,6 +364,11 @@ func (s) TestWeightedTarget(t *testing.T) { | |||
if state != connectivity.TransientFailure { | |||
t.Fatalf("Empty target update should have triggered a TF state update, got: %v", state) | |||
} | |||
p = <-cc.NewPickerCh | |||
const wantErr = "no targets to pick from" | |||
if _, err := p.Pick(balancer.PickInfo{}); !strings.Contains(err.Error(), wantErr) { |
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.
If err
is nil this will panic.
if _, err := p.Pick(balancer.PickInfo{}); !strings.Contains(err.Error(), wantErr) { | |
if _, err := p.Pick(balancer.PickInfo{}); err == nil || !strings.Contains(err.Error(), wantErr) { |
Or
if _, err := p.Pick(balancer.PickInfo{}); !strings.Contains(fmt.Sprint(err), wantErr) {
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. Done.
1947074
to
22ad462
Compare
Fixes a bug in the
weighted_target
LB policy wherein it was queueing RPCs even though it was setting the overall connectivity state toTRANSIENT_FAILURE
.RELEASE NOTES:
UNAVAILABLE
when the EDS resource is missing or contains no endpoints