ChainSafe / ChainSafe/gossamer

tests: refactor production/integration test code in `dot/network` to randomly bind on port `0`

Open
#2,346 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Task summary

For now we circle around a buffered channel to get a 'random' port in a certain port range. The problem is if this port is being listened on by another application (or another test), they will conflict and one of the tests will fail.

Instead we should have it listen on port `0` so the OS assigns it a random free port.
The production code should be refactored to listen on a port and return the listening port without releasing/closing the network listener. An example of such code is in `internal/httpserver`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.