Static variables made thread-safe in Rust
When writing integration tests for my Rustnish reverse proxy project I have hard-coded port numbers in tests. This is not ideal because it is hard to keep track of which port numbers have already been used and which ones are available when writing a new test. Because Rust's test runner executes test cases in parallel it is important to coordinate which test uses which ports so that there are no clashes that break the tests.
One obvious solution to this problem would be to disable parallel test
execution with cargo test -- --test-threads=1. But we want to cover program
and test isolation with our test so this is not really an option.
