Skip to content

cleanup: replace dial with newclient - #8196

Merged
arjan-bal merged 14 commits into
grpc:masterfrom
janardhanvissa:replacing-dial-to-newclient
May 12, 2025
Merged

cleanup: replace dial with newclient#8196
arjan-bal merged 14 commits into
grpc:masterfrom
janardhanvissa:replacing-dial-to-newclient

Conversation

@janardhanvissa

Copy link
Copy Markdown
Contributor

addresses: #7049

RELEASE NOTES: None

@arjan-bal

Copy link
Copy Markdown
Contributor

Is this PR ready for review?

@janardhanvissa

Copy link
Copy Markdown
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

@arjan-bal arjan-bal left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread balancer/pickfirst/pickfirst_ext_test.go Outdated
Comment thread balancer/grpclb/grpclb_test.go
Comment thread balancer/endpointsharding/endpointsharding_test.go
Comment thread balancer/rls/balancer_test.go
Comment thread balancer/rls/balancer_test.go
Comment thread xds/test/eds_resource_missing_test.go
Comment thread xds/server_ext_test.go
Comment thread xds/internal/xdsclient/tests/fallback_test.go
Comment thread test/channelz_test.go Outdated
Comment thread test/clientconn_state_transition_test.go
Comment thread stats/stats_test.go
Comment thread stats/stats_test.go Outdated
@codecov

codecov Bot commented Apr 29, 2025

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor

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

Comment thread credentials/insecure/insecure.go Outdated
//
// 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
Copy Markdown
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 thread dialoptions.go Outdated
// 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
Copy Markdown
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 thread stats/stats_test.go Outdated
Comment on lines +296 to +297
ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()

Copy link
Copy Markdown
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.

Comment thread test/end2end_test.go
te.t.Fatalf("Dial(%q) = %v", scheme+te.srvAddr, err)
te.t.Fatalf("grpc.NewClient() failed(%q) = %v", scheme+te.srvAddr, err)
}
te.cc.Connect()

Copy link
Copy Markdown
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
Copy Markdown
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

@arjan-bal arjan-bal left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread stats/stats_test.go Outdated
te.cc, err = grpc.NewClient(te.srvAddr, opts...)
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
Copy Markdown
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
Comment thread test/end2end_test.go Outdated
te.cc, err = grpc.NewClient(scheme+te.srvAddr, opts...)
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
Copy Markdown
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
vinothkumarr227 pushed a commit to vinothkumarr227/grpc-go that referenced this pull request May 26, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants