Skip to content

chore: reduce waste in port allocations of some tests #7456

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

Merged
merged 1 commit into from
Aug 12, 2025

Conversation

alexpyattaev
Copy link

@alexpyattaev alexpyattaev commented Aug 11, 2025

Problem

Certain test use too many ports so we can get out-of-ports issues in CI.
This is especially a problem since we want to allocate more ports for main validator allocations as in #7455

Summary of Changes

Tame their appetite for ports a bit
This does not change any logic.

@alexpyattaev alexpyattaev marked this pull request as ready for review August 11, 2025 19:23
@alexpyattaev alexpyattaev changed the title fix some tests to not waste port allocations chore: reduce waste in port allocations of some tests Aug 11, 2025
Copy link

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

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

mostly looks good. just a couple thoughts

for _ in 0..MAX_PORT_VERIFY_THREADS * 2 {
let port_range = unique_port_range_for_tests(1);

Choose a reason for hiding this comment

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

wonder if in the future, we could release these port ranges and reuse them...

Copy link
Author

Choose a reason for hiding this comment

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

we are reusing them already! just not within the same process, only with next test.

Choose a reason for hiding this comment

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

ohhhh got it. misunderstood the next test setup

let (_server_port, (_, server_tcp_listener)) =
bind_common_in_range_with_config(ip_addr, (2200, 2300), config).unwrap();
bind_common_in_range_with_config(ip_addr, (port_range.start, port_range.end), config)

Choose a reason for hiding this comment

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

so this function is deprecated. should we move these tests over to net-utils/src/sockets.rs?

Copy link
Author

Choose a reason for hiding this comment

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

I'll make another PR to axe the deprecated functions.

Comment on lines -926 to +933
(2300, 2300 + (MAX_PORT_VERIFY_THREADS * 3) as u16),
(port_range.start, port_range.end),

Choose a reason for hiding this comment

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

aren't we kind of defeating the purpose of this test if our port range is 1?

Copy link
Author

Choose a reason for hiding this comment

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

The allocation of ports is not what we are testing here, this is testing the verification that they are reachable.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.3%. Comparing base (a09996b) to head (604ba3f).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #7456     +/-   ##
=========================================
- Coverage    83.3%    83.3%   -0.1%     
=========================================
  Files         800      800             
  Lines      362783   362796     +13     
=========================================
- Hits       302227   302222      -5     
- Misses      60556    60574     +18     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gregcusack gregcusack left a comment

Choose a reason for hiding this comment

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

lgtm!

@alexpyattaev alexpyattaev merged commit 8abf225 into anza-xyz:master Aug 12, 2025
40 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.

3 participants