Documentation
¶
Overview ¶
Package testport hands tests loopback ports a server can bind again after it stops: a broker or node restarted on its old port must find that port free while it is down.
A port in the operating system's ephemeral range is not: any outgoing connection can be given it as its source port, and many tests running at once open thousands of them. The ports here are drawn from below every default ephemeral range (Linux 32768 to 60999, Windows and macOS 49152 to 65535), so only a listener can take one.
Each port handed out is also reserved, by a lock file under the temporary directory, until the test that took it ends. Another caller, in this test binary or another one running at the same time, skips a reserved port, and never binds it to check it is free, so a port stays the test's while its server is down.
It is a test helper. Production code must not import it.
Index ¶
Constants ¶
const ( RangeLow = 20000 RangeHigh = 32768 )
RangeLow and RangeHigh bound the ports Free hands out.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.