f0c3dca49c
Copy the updated version of freeport (sdk/freeport), and tweak it for use in Nomad tests. This means staying below port 10000 to avoid conflicts with the lib/freeport that is still transitively used by the old version of consul that we vendor. Also provide implementations to find ephemeral ports of macOS and Windows environments. Ports acquired through freeport are supposed to be returned to freeport, which this change now also introduces. Many tests are modified to include calls to a cleanup function for Server objects. This should help quite a bit with some flakey tests, but not all of them. Our port problems will not go away completely until we upgrade our vendor version of consul. With Go modules, we'll probably do a 'replace' to swap out other copies of freeport with the one now in 'nomad/helper/freeport'.
12 lines
375 B
Go
12 lines
375 B
Go
//+build windows
|
|
|
|
package freeport
|
|
|
|
// For now we hard-code the Windows ephemeral port range, which is documented by
|
|
// Microsoft to be in this range for Vista / Server 2008 and newer.
|
|
//
|
|
// https://support.microsoft.com/en-us/help/832017/service-overview-and-network-port-requirements-for-windows
|
|
func getEphemeralPortRange() (int, int, error) {
|
|
return 49152, 65535, nil
|
|
}
|