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 28 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

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.04%. Comparing base (6f41085) to head (e7e95ce).

Files with missing lines Patch % Lines
stream.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7967      +/-   ##
==========================================
- Coverage   82.17%   82.04%   -0.13%     
==========================================
  Files         381      381              
  Lines       38539    38535       -4     
==========================================
- Hits        31668    31615      -53     
- Misses       5564     5603      +39     
- Partials     1307     1317      +10     
Files with missing lines Coverage Δ
internal/transport/handler_server.go 86.46% <100.00%> (ø)
internal/xds/rbac/rbac_engine.go 80.74% <ø> (-0.47%) ⬇️
xds/internal/balancer/clusterimpl/picker.go 97.00% <100.00%> (ø)
xds/internal/xdsclient/transport/ads/ads_stream.go 83.84% <100.00%> (-1.75%) ⬇️
stream.go 81.69% <0.00%> (-0.26%) ⬇️

... and 22 files with indirect coverage changes

grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"loadBalancingConfig": [{"%s":{}}]}`, stateRecordingBalancerName)))
if err != nil {
t.Fatal(err)
}
defer client.Close()

client.Connect()
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a call to testutils.StayConnected below, do we need to call connect here? Please consider this every time you replace Dial with NewClient across all PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getting the below error without connect() call

timed out waiting for state 0 (CONNECTING) in flow [CONNECTING READY IDLE CONNECTING]

ctx, dialCancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer dialCancel()
cc, err := grpc.DialContext(ctx, "", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(d))
cc, err := grpc.NewClient("localhost:0", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(d))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use passthrough instead of changing the hostname. I've mentioned the usage of custom dialers before.

}
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.

Instead of calling cc.Connect here make the callers of setupForSecurityTests call it only if needed.

}
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.

Instead of calling cc.Connect here make the callers of setupWithManagementServerAndListener call it only if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment for other setup functions.

Comment on lines +313 to +314
if cc1, err = grpc.NewClient(lis1.Addr().String(), grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())); err != nil {
t.Fatal("Failed to create clientConn to a server in \"not-serving\" state")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the same assertion as before. You need to make an RPC and check that it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants