-
-
Notifications
You must be signed in to change notification settings - Fork 111
Description
use-case
My tests are starting different servers, picking TCP a free port randomly. I first need to pick a port, and then run the http server as the port is being used is some shared configuration. I cannot "simply" use the 120.0.0.1:0
approach. I'm using port-selector for that. I could also use reserve-port but it does not help when running with nextest.
When running with nextest, as tests are running in different processes in parallel, it can happen that 2 tests pick the same port.
My current mitigation is to use the retry mechanism to restart the tests failing because they pick identical ports. The tests themselves are not flaky, but running them in parallel make them flaky.
Idea
One possible idea would be to use network isolation on linux, so that each process can pick same ports without conflict.
Possible issues
- Network isolation only works on Linux kernel ( I haven't checked other OSs).
- It adds complexity, in the code of nextest. And it can also add complexity on how to configure those namespaces, if they need to access internet...
- Creating new namespaces requires privileges