diff options
author | Kevin Krakauer <krakauer@google.com> | 2021-04-15 17:13:34 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-15 17:16:08 -0700 |
commit | 19dfc4f7af2bd1f204d1973d3e3ced1f1adf615e (patch) | |
tree | 962ca37079aa1f08df6565022ef5df6fcd5d44ee /pkg/tcpip/transport/tcp | |
parent | 2e5022974908669d55cf7f47ff8fb7ff5c70c34c (diff) |
Reduce tcp_x_test runtime and memory usage
Reduce the ephemeral port range, which decreases the calls to makeEP.
PiperOrigin-RevId: 368748379
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r-- | pkg/tcpip/transport/tcp/tcp_test.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/tcpip/transport/tcp/tcp_test.go b/pkg/tcpip/transport/tcp/tcp_test.go index 1cdc41fd3..74e11ab84 100644 --- a/pkg/tcpip/transport/tcp/tcp_test.go +++ b/pkg/tcpip/transport/tcp/tcp_test.go @@ -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) |