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

test: improve getFreePort implementation #4373

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Jul 24, 2024

What this PR changes/adds

Improve getFreePort implementation, following the camel implementation and comments reported on stackoverflow:
https://stackoverflow.com/a/435579

the idea is to check not only ServerSocket but also DatagramSocket and Socket.

Why it does that

the Address already in use flaky tests still happening from time to time.

Further notes

  • had to define 3 different predicates because the 3 *Socket classes doesn't implement any common interface besides Closable (!!!)

Linked Issue(s)

Closes # <-- insert Issue number if one exists

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@ndr-brt ndr-brt added the build Anything related to the CI/CD Pipeline on Github Actions label Jul 24, 2024
@ndr-brt ndr-brt force-pushed the improve-getfreeport branch from e318093 to 6a6b1d1 Compare July 24, 2024 08:34
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.

Project coverage is 74.91%. Comparing base (7f20ba5) to head (6a6b1d1).
Report is 365 commits behind head on main.

Files Patch % Lines
...b/src/main/java/org/eclipse/edc/util/io/Ports.java 66.66% 7 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4373      +/-   ##
==========================================
+ Coverage   71.74%   74.91%   +3.16%     
==========================================
  Files         919     1066     +147     
  Lines       18457    21405    +2948     
  Branches     1037     1173     +136     
==========================================
+ Hits        13242    16035    +2793     
- Misses       4756     4845      +89     
- Partials      459      525      +66     

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

@ndr-brt ndr-brt merged commit 1ce4687 into eclipse-edc:main Jul 24, 2024
23 checks passed
@ndr-brt ndr-brt deleted the improve-getfreeport branch July 24, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Anything related to the CI/CD Pipeline on Github Actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants