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

pickfirst: Stop test servers without closing listeners #7872

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

arjan-bal
Copy link
Contributor

Fixes: #7868

In the above issue, the test failed with the following error log:

pickfirstleaf_ext_test.go:700: Failed to start server: net.Listen("tcp", "127.0.0.1:39795") = listen tcp 127.0.0.1:39795: bind: address already in use

In the test, the server was shut down and it couldn't bind to the same port when it tried to start again. This PR uses restartable listeners for the test server and exposes a methods on the test server to stop and restart the servers without closing the listeners.

RELEASE NOTES: N/A

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.04%. Comparing base (8b70aeb) to head (1cc5991).
Report is 10 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7872   +/-   ##
=======================================
  Coverage   82.04%   82.04%           
=======================================
  Files         377      377           
  Lines       38065    38112   +47     
=======================================
+ Hits        31229    31269   +40     
  Misses       5542     5542           
- Partials     1294     1301    +7     

see 25 files with indirect coverage changes

Comment on lines 87 to 90
l, err := testutils.LocalTCPListener()
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could accept a testing.T here, make this a test helper and call t.Fatalf here if creating the listener fails. That would simplify callsites since they wont have to handle two return values.

@easwars easwars assigned arjan-bal and unassigned easwars Dec 2, 2024
@arjan-bal arjan-bal merged commit 78aa51b into grpc:master Dec 3, 2024
15 checks passed
@arjan-bal arjan-bal deleted the flaky-test-7868 branch December 3, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky Test: Test/PickFirstLeaf_StopConnectedServer_SecondServerToFirst
2 participants