6cb2bccca6
Use systemctl to properly detect ephemeral ports on Mac OS (aka darwin) by fetching systemctl values: * net.inet.ip.portrange.first * net.inet.ip.portrange.last This will avoid the message: `[INFO] freeport: ephemeral port range detection not configured for GOOS="darwin"` and properly detect the correct port range
19 lines
333 B
Go
19 lines
333 B
Go
//+build darwin
|
|
|
|
package freeport
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGetEphemeralPortRange(t *testing.T) {
|
|
min, max, err := getEphemeralPortRange()
|
|
if err != nil {
|
|
t.Fatalf("err: %v", err)
|
|
}
|
|
if min <= 0 || max <= 0 || min > max {
|
|
t.Fatalf("unexpected values: min=%d, max=%d", min, max)
|
|
}
|
|
t.Logf("min=%d, max=%d", min, max)
|
|
}
|