laminar
laminar copied to clipboard
Make tests use OS-assigned ports instead of a manual specified port
Task Description
Hard-coding test ports are error-prone. We should use the OS loopback interface to find any available port instead of manually ensuring that ports on each test are different.
In rust we are able to use 127.0.0.1:0
, next the OS will asignt a free port.
Task TODO
- [ ] Check if loopback address can be used inside tests.
- [ ] Inventarize all places where ports are bein hardcoded, report them here
- [ ] Change all places to the dynamic port where possible.
Agree, we did do that, however, when I did this in the past I got some 'address is already in use errors', not sure why it did not resolve the port automatically.
I'm not sure how you implemented it but might be a TOCTOU error. (I can't find the use of loopbacks in the git log)
I guess there is one way to find out, just change the tests and see what it does.
Will wait for https://github.com/amethyst/laminar/pull/196 to merge
Is this still something that should happen? I went through and patched all the tests I could find. There is one test in connection_manager.rs
I omitted because it used FakeSocket. All the tests seem to run on my machine, if this vaguely looks ok I can submit a PR.