Skip to content

Fix tests to run on a random port#330

Open
erickt wants to merge 3 commits intorustls:mainfrom
erickt:fix-tests
Open

Fix tests to run on a random port#330
erickt wants to merge 3 commits intorustls:mainfrom
erickt:fix-tests

Conversation

@erickt
Copy link
Contributor

@erickt erickt commented Feb 15, 2026

This changes the tests to run on a random port rather than fixed ones in order to avoid a potential conflict with other processes using ports 1337 or 1338. It also adds a few asserts to log the STDOUT or STDERR if the example client or server fails for some reason.

@erickt erickt force-pushed the fix-tests branch 2 times, most recently from 45a0405 to 712d758 Compare February 15, 2026 18:02
Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

This commit has a lot going on, and I'd like it to be split into smaller commits that make one logical change:

  • Replace use of existing binaries with using cargo run
  • Using a random port
  • Potentially other commits with miscellaneous changes

Before this patch, the `server` and `custom_ca_store` tests would run on
either port 1337 or 1338, but some other process could be using those
ports, which would confuse the results. This changes the tests to
instead use a random port in order to be more consistent.
@erickt
Copy link
Contributor Author

erickt commented Feb 17, 2026

I broke up the PR into a few patches, or would you rather them to be separate PRs? I did however leave out the "run using cargo" change since I realized that that would change the test semantics. At the moment the examples are built with whatever flags you specify, but my change would hardcode the list. That change could be useful, but we could consider it in a separate PR. I'll update the PR description with this in mind.

@erickt erickt changed the title Fix tests to build examples and run on a random port Fix tests to run on a random port Feb 17, 2026
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

Comments