-
Notifications
You must be signed in to change notification settings - Fork 4.5k
cleanup: replace dial with newclient #8196
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
base: master
Are you sure you want to change the base?
cleanup: replace dial with newclient #8196
Conversation
Is this PR ready for review? |
yes, please |
6458128
to
d672f29
Compare
This reverts commit 79f6f35.
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.
There are a lot of unnecessary log message changes added in this PR. This makes it really hard to spot and review actual code changes.
t.Fatalf("Failed to create new client: %v", err) | ||
t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err) |
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.
Please revert.
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.
These log messages are suggested by Easwar's in other PR. Please see the discussion using the below links.
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 don't think Easwar expected you to change log messages throughout the entire repo. The log messages are relatively harmless and can be fixed incrementally when people work on these parts of the codebase. Fixing them in a PR with real code changes makes it hard for reviewers to focus on the important parts.
balancer/grpclb/grpclb_test.go
Outdated
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.
Please revert this file as all the changes are only in error messages.
@@ -166,7 +165,7 @@ func (s) TestEndpointShardingBasic(t *testing.T) { | |||
} | |||
cc, err := grpc.NewClient(mr.Scheme()+":///", dOpts...) | |||
if err != nil { | |||
log.Fatalf("Failed to create new client: %v", err) |
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.
Please only change log
to t
, the error message is fine.
balancer/rls/balancer_test.go
Outdated
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.
Please revert changes in this file as they are only error message changes.
balancer/rls/balancer_test.go
Outdated
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.
Please revert changes in this file as they are only error message changes.
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.
Please revert.
xds/server_ext_test.go
Outdated
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.
Please revert.
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.
Please revert.
test/channelz_test.go
Outdated
@@ -308,7 +308,7 @@ func (s) TestCZTopChannelRegistrationAndDeletionWhenDialFail(t *testing.T) { | |||
// Make dial fails (due to no transport security specified) | |||
_, err := grpc.NewClient("fake.addr") | |||
if err == nil { | |||
t.Fatal("expecting dial to fail") | |||
t.Fatalf("grpc.NewClient() failed: %v", err) |
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.
The message being replaced was the opposite, please fix.
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.
Please revert.
@@ -274,7 +274,6 @@ func (te *test) clientConn() *grpc.ClientConn { | |||
} | |||
opts := []grpc.DialOption{ | |||
grpc.WithTransportCredentials(insecure.NewCredentials()), | |||
grpc.WithBlock(), |
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 you are removing WithBlock
, you need to ensure the clientconn is ready before the function returns it. I ssupect this is the reason for the race conditions that you're seeing. Please use cc.Connect and testutils.AwaitState
here to restore the behviour.
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 pointing that out — you're absolutely right. Removing WithBlock
without ensuring the connection is ready was likely the cause of the race conditions. I've now updated the code to call cc.Connect() and use testutils.AwaitState
to properly wait for Ready before returning. Apologies for overlooking this earlier!
stats/stats_test.go
Outdated
func checkPickerUpdated(t *testing.T, d *gotData, e *expectedData) { | ||
var ( | ||
ok bool | ||
st *stats.PickerUpdated | ||
) | ||
if st, ok = d.s.(*stats.PickerUpdated); !ok { | ||
t.Fatalf("got %T, want PickerUpdated", d.s) | ||
} | ||
if d.ctx == nil { | ||
t.Fatalf("d.ctx = nil, want <non-nil>") | ||
} | ||
st.IsClient() // TODO remove this. | ||
} |
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.
Please revert any assertion changes, we don't want to change the test logic.
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.
reverted
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8196 +/- ##
==========================================
+ Coverage 82.06% 82.16% +0.09%
==========================================
Files 410 417 +7
Lines 40233 41356 +1123
==========================================
+ Hits 33018 33979 +961
- Misses 5854 5950 +96
- Partials 1361 1427 +66
🚀 New features to boost your workflow:
|
I've addressed all the comments by reverting the changes related to log message updates and fixing the race condition by calling |
@arjan-bal I think Janardhan has reverted the unnecessary changes in the PR. It should be ready for review now. |
addresses: #7049
RELEASE NOTES: None