Reduce tcp_x_test runtime and memory usage

Reduce the ephemeral port range, which decreases the calls to makeEP.

PiperOrigin-RevId: 368748379
This commit is contained in:
Kevin Krakauer 2021-04-15 17:13:34 -07:00 committed by gVisor bot
parent 2e50229749
commit 19dfc4f7af
1 changed files with 7 additions and 1 deletions

View File

@ -4899,7 +4899,13 @@ func TestConnectAvoidsBoundPorts(t *testing.T) {
t.Fatalf("unknown address type: '%s'", candidateAddressType)
}
start, end := s.PortRange()
const (
start = 16000
end = 16050
)
if err := s.SetPortRange(start, end); err != nil {
t.Fatalf("got s.SetPortRange(%d, %d) = %s, want = nil", start, end, err)
}
for i := start; i <= end; i++ {
if makeEP(exhaustedNetwork).Bind(tcpip.FullAddress{Addr: address(t, exhaustedAddressType, isAny), Port: uint16(i)}); err != nil {
t.Fatalf("Bind(%d) failed: %s", i, err)