-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: propagate bootstrap error to grpc.Dial #3330
Conversation
c17891e
to
20e5b55
Compare
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.
Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @menghanl)
xds/internal/balancer/edsbalancer/xds_client_wrapper.go, line 137 at r1 (raw file):
clientConfig = &bootstrap.Config{ BalancerName: config.BalancerName, }
Nit: Fold into a single line since we are setting only one field?
xds/internal/balancer/edsbalancer/xds_client_wrapper.go, line 141 at r1 (raw file):
} else if clientConfig.BalancerName == "" { clientConfig.BalancerName = config.BalancerName }
Do we need the else, given that NewConfig
has been updated to return an error when BalancerName
is empty?
xds/internal/client/bootstrap/bootstrap_test.go, line 247 at r1 (raw file):
Quoted 9 lines of code…
if test.wantError { if err == nil { t.Fatalf("wantError: %v, got error %v", test.wantError, err) } return } if err != nil { t.Fatalf("unexpected error %v", err) }
Could this be handled with a single conditional statement like:
if (err != nil) != test.wantErr {
t.Fatalf("NewConfig() returned err: %v, wantErr: %v", err, test.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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @easwars)
xds/internal/balancer/edsbalancer/xds_client_wrapper.go, line 137 at r1 (raw file):
Previously, easwars (Easwar Swaminathan) wrote…
clientConfig = &bootstrap.Config{ BalancerName: config.BalancerName, }
Nit: Fold into a single line since we are setting only one field?
Done
xds/internal/balancer/edsbalancer/xds_client_wrapper.go, line 141 at r1 (raw file):
Previously, easwars (Easwar Swaminathan) wrote…
} else if clientConfig.BalancerName == "" { clientConfig.BalancerName = config.BalancerName }
Do we need the else, given that
NewConfig
has been updated to return an error whenBalancerName
is empty?
Done. Needed to make some changes to tests to get BalancerName (which is being removed in another PR...).
xds/internal/client/bootstrap/bootstrap_test.go, line 247 at r1 (raw file):
Previously, easwars (Easwar Swaminathan) wrote…
if test.wantError { if err == nil { t.Fatalf("wantError: %v, got error %v", test.wantError, err) } return } if err != nil { t.Fatalf("unexpected error %v", err) }
Could this be handled with a single conditional statement like:
if (err != nil) != test.wantErr { t.Fatalf("NewConfig() returned err: %v, wantErr: %v", err, test.wantErr) }
I need it to return in case of errors, otherwise the following code will nil panic.
I reversed the order, to make it look slightly better. But there are still two if statements
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.
Reviewed 4 of 4 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)