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

2882 Apply dynamic port fixture for tests of cli, config and server … #2892

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

iAndriy
Copy link
Contributor

@iAndriy iAndriy commented Jan 7, 2024

No description provided.

@iAndriy iAndriy requested a review from a team as a code owner January 7, 2024 18:11
Copy link

codecov bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.012%. Comparing base (afe4f27) to head (1889d91).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2892   +/-   ##
=========================================
  Coverage   88.012%   88.012%           
=========================================
  Files           94        94           
  Lines         7408      7408           
  Branches      1307      1307           
=========================================
  Hits          6520      6520           
  Misses         598       598           
  Partials       290       290           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Tronic
Copy link
Member

Tronic commented Jan 15, 2024

There is a race condition in get_port because the socket opened is closed when returning the function so another process running at the same time could accidentally get the same port. If it instead returned the socket, that was then used with server, there would be no such issue, but that cannot work with CLI tests where no socket can be passed.

Alternatively, simply picking a random int would possibly be faster and still only very rarely have collisions. Presumably the kernel essentially picks a random number each time we bind to port 0, so this might be close to current behavior.

@ahopkins ahopkins merged commit 1a70930 into sanic-org:main Apr 1, 2024
27 checks passed
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.

None yet

3 participants