From 19dfc4f7af2bd1f204d1973d3e3ced1f1adf615e Mon Sep 17 00:00:00 2001 From: Kevin Krakauer Date: Thu, 15 Apr 2021 17:13:34 -0700 Subject: Reduce tcp_x_test runtime and memory usage Reduce the ephemeral port range, which decreases the calls to makeEP. PiperOrigin-RevId: 368748379 --- pkg/tcpip/transport/tcp/tcp_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkg') 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) -- cgit v1.2.3