-
Notifications
You must be signed in to change notification settings - Fork 51
Fix random test failure due to port collision #156
Copy link
Copy link
Closed
Labels
BugIncorrect BehaviorIncorrect Behavior
Description
For the API testing, we are using an independent API server for each test because:
- We want tests to be isolated.
- Sometimes, we need a specific tracker configuration for the test.
We assign a random port for each API server and test with a function like this:
fn random_port() -> u16 {
// todo: this may produce random test failures because two tests can try to bind the same port.
// We could create a pool of available ports (with read/write lock)
let mut rng = thread_rng();
rng.gen_range(49152..65535)
}
We have reached a high number of parallel running tests that produces this conflict too often.
We could create a centralised free-of-race-conditions service which assigns the free port numbers.
We could also reuse API server for tests that use the same configuration and do not conflict, but I would like to avoid that because it can generate hidden coupling between tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIncorrect BehaviorIncorrect Behavior
Type
Projects
Status
No status