Skip to content
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

cleanup: replace dial with newclient #7967

Open
wants to merge 65 commits into
base: master
Choose a base branch
from

Conversation

janardhanvissa
Copy link
Contributor

Partially address: #7049

RELEASE NOTES: None

Copy link

codecov bot commented Dec 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.35%. Comparing base (ae2a04f) to head (9dc0cfd).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7967      +/-   ##
==========================================
+ Coverage   82.29%   82.35%   +0.06%     
==========================================
  Files         387      387              
  Lines       38967    38942      -25     
==========================================
+ Hits        32066    32071       +5     
+ Misses       5586     5563      -23     
+ Partials     1315     1308       -7     

see 33 files with indirect coverage changes

@janardhanvissa janardhanvissa removed their assignment Feb 18, 2025
@arjan-bal arjan-bal self-assigned this Feb 18, 2025
@arjan-bal
Copy link
Contributor

Please don't use git rebase and force push. This re-writes all the commits on the branch and Github can no longer track the diff since the last time a reviewer saw the PR. This means that I need to review the entire PR again, instead of just the diff since last review.

@janardhanvissa janardhanvissa removed their assignment Feb 18, 2025
@arjan-bal arjan-bal self-assigned this Feb 20, 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, assigning a second reviewer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this file, none of the changes are related to DIal to NewClient migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@arjan-bal arjan-bal added this to the 1.72 Release milestone Feb 20, 2025
@arjan-bal arjan-bal added the Type: Internal Cleanup Refactors, etc label Feb 20, 2025
@arjan-bal arjan-bal assigned easwars and janardhanvissa and unassigned arjan-bal Feb 20, 2025
@arjan-bal arjan-bal requested a review from easwars February 20, 2025 09:13
@janardhanvissa janardhanvissa removed their assignment Feb 20, 2025
if err != nil {
t.Fatal("Error dialing:", err)
t.Fatal("Failed to create a client for server:", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be a very useful test failure message. How about just saying t.Fatal("NewClient() failed: %v", err). Here and elsewhere in this PR. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

And wherever possible, include the target URI passed to NewClient in the error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if err != nil {
t.Fatalf("grpc.DialContext(_, %q, _) = %v", lis.Addr().String(), err)
t.Fatalf("grpc.NewClient(_, %q, _) = %v", lis.Addr().String(), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be:

t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


_, err = testgrpc.NewTestServiceClient(cc1).FullDuplexCall(ctx)
if err == nil || status.Code(err) != codes.Unavailable {
t.Fatalf("Expected FullDuplexCall to fail with status code Unavailable, got: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Git before want in error strings please. See: go/go-style/decisions#got-before-want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -817,7 +817,7 @@ func (s) TestAggregatedCluster_CycleWithNoLeafNode(t *testing.T) {
func (s) TestAggregatedCluster_CycleWithLeafNode(t *testing.T) {
lbCfgCh, _, _, _ := registerWrappedClusterResolverPolicy(t)
mgmtServer, nodeID, cc, _, _, _, _ := setupWithManagementServer(t)

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.

Do we really need to call Connect here? Can this be moved inside the helper function setupWithManagementServer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -393,7 +393,7 @@ func (s) TestSecurityConfigNotFoundInBootstrap(t *testing.T) {

// Create a grpc channel with xDS creds.
cc, _ := setupForSecurityTests(t, bootstrapContents, xdsClientCredsWithInsecureFallback(t), nil)

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.

Same here. Do we need the call to Connect? Aren't we doing an RPC later on? Can/Should we move this to be inside the helper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

_, _, _, r, xdsClient, cdsResourceRequestedCh, _ := setupWithManagementServer(t)

_, _, cc, r, xdsClient, cdsResourceRequestedCh, _ := setupWithManagementServer(t)
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.

Same comment as above regarding the call to Connect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -250,7 +251,7 @@ func (s) TestErrorFromParentLB_ResourceNotFound(t *testing.T) {
// resolver, and dial the test backends.
cc, cleanup := setupAndDial(t, bootstrapContents)
defer cleanup()

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.

Same comment about Connect for tests in this file too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@easwars easwars assigned janardhanvissa and unassigned easwars Feb 20, 2025
@janardhanvissa
Copy link
Contributor Author

All the above comments are addressed. Please re-review once,

@janardhanvissa janardhanvissa removed their assignment Feb 20, 2025
@easwars easwars self-assigned this Feb 21, 2025
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.

4 participants