Skip to content

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

Merged
merged 14 commits into from
May 12, 2025

Conversation

janardhanvissa
Copy link
Contributor

addresses: #7049

RELEASE NOTES: None

@arjan-bal
Copy link
Contributor

Is this PR ready for review?

@janardhanvissa
Copy link
Contributor Author

Is this PR ready for review?

yes, please

@janardhanvissa janardhanvissa force-pushed the replacing-dial-to-newclient branch from 6458128 to d672f29 Compare April 23, 2025 07:21
Copy link
Contributor

@arjan-bal arjan-bal left a 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.

Copy link

codecov bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.08%. Comparing base (b0d1203) to head (ccdb7b0).
Report is 57 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8196      +/-   ##
==========================================
+ Coverage   82.06%   82.08%   +0.02%     
==========================================
  Files         410      419       +9     
  Lines       40233    41988    +1755     
==========================================
+ Hits        33018    34467    +1449     
- Misses       5854     6046     +192     
- Partials     1361     1475     +114     
Files with missing lines Coverage Δ
credentials/insecure/insecure.go 83.33% <ø> (+1.51%) ⬆️
dialoptions.go 90.80% <ø> (ø)

... and 113 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@janardhanvissa
Copy link
Contributor Author

I've addressed all the comments by reverting the changes related to log message updates and fixing the race condition by calling cc.Connect() and using AwaitState to wait for the READY state.

@janardhanvissa janardhanvissa removed their assignment Apr 30, 2025
@vinothkumarr227
Copy link
Contributor

@arjan-bal I think Janardhan has reverted the unnecessary changes in the PR. It should be ready for review now.

@@ -30,7 +30,7 @@ import (
// NewCredentials returns a credentials which disables transport security.
//
// Note that using this credentials with per-RPC credentials which require
// transport security is incompatible and will cause grpc.Dial() to fail.
// transport security is incompatible and will cause grpc.NewClient() to fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this line needs to be updated to say that RPCs will fail and not grpc.NewClient().

dialoptions.go Outdated
@@ -360,7 +360,7 @@ func WithReturnConnectionError() DialOption {
//
// Note that using this DialOption with per-RPC credentials (through
// WithCredentialsBundle or WithPerRPCCredentials) which require transport
// security is incompatible and will cause grpc.Dial() to fail.
// security is incompatible and will cause grpc.NewClient() to fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this line needs to be updated to say that RPCs will fail and not grpc.NewClient().

Comment on lines 296 to 297
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not create a context in this method, instead pass a context created in the original test function. This ensures the entire test has 10 secs to run. Presently if a test created channels in a for loop, the overall test timeout will get multiplied.

}
te.cc.Connect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actionable: Normally I would suggest moving the Connect() call to the calling functions because most of the callers wouldn't need it as they're making RPCs. In this case, there are 116 references, so we can keep the existing behaviour.

@vinothkumarr227
Copy link
Contributor

@arjan-bal The changes are done, it's ready for review

@arjan-bal arjan-bal added the Type: Internal Cleanup Refactors, etc label May 9, 2025
@arjan-bal arjan-bal added this to the 1.73 Release milestone May 9, 2025
Copy link
Contributor

@arjan-bal arjan-bal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one minor comment.

if err != nil {
te.t.Fatalf("Dial(%q) = %v", te.srvAddr, err)
te.t.Fatalf("grpc.NewClient() failed(%q) = %v", te.srvAddr, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(%q) should be logged just after the function name as it's an argument.

@arjan-bal arjan-bal requested a review from dfawley May 9, 2025 03:45
if err != nil {
te.t.Fatalf("Dial(%q) = %v", scheme+te.srvAddr, err)
te.t.Fatalf("grpc.NewClient() failed(%q) = %v", scheme+te.srvAddr, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
te.t.Fatalf("grpc.NewClient() failed(%q) = %v", scheme+te.srvAddr, err)
te.t.Fatalf("grpc.NewClient(%q) failed: %v", scheme+te.srvAddr, err)

@dfawley dfawley assigned janardhanvissa and unassigned dfawley May 9, 2025
@janardhanvissa janardhanvissa removed their assignment May 12, 2025
@arjan-bal arjan-bal merged commit d3d2702 into grpc:master May 12, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants