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

Don't bind to fixed ports in tests #126

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Dec 19, 2023

This PR is overtly about fixing a problem in the new tests, which is that they used fixed port numbers (06a7e8f). Fixing that made it obvious to me where the commonality in tests was, so this PR also cuts down a lot of the boilerplate.

Previously we used fixed ports for tests. If someone else happened to be
using those ports, then the test failed. This commit has test listening
on port 0, which causes the OS to allocate an unused port. In order that
we can connect, we need snare to tell us what port it's bound to, a
feature which is gated behind an `_internal_testing` feature.

It's quite hard to integrate the old `bad_config` test into this new
framework (my attempt ended up with some surprising type inference
errors). Since it's testing something that's well captured elsewhere
(the unittests in `Config`), I've removed it rather than make the test
runner even more complex than it now is.
Since we no longer have any tests which don't cause snare to exit
successfully, we don't need to carry this around as a parameter. This
slightly simplifies the code.
@vext01 vext01 added this pull request to the merge queue Dec 19, 2023
Merged via the queue into softdevteam:master with commit 8354638 Dec 19, 2023
1 check passed
@ltratt ltratt deleted the dont_bind_to_fixed_ports branch April 2, 2024 10:59
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.

2 participants