diff --git a/common/net/configure_port_test.go b/common/net/configure_port_test.go index 5117a70d0..8f01ade46 100644 --- a/common/net/configure_port_test.go +++ b/common/net/configure_port_test.go @@ -53,8 +53,10 @@ func TestListenRangeConfig_Listen(t *testing.T) { Min: lockedListener.Port, Max: lockedListener.Port, }.Listen(ctx) - if err != context.DeadlineExceeded { + if l != nil { l.Close() + } + if err != context.DeadlineExceeded { t.Fatalf("port should be taken, this should timeout: %v", err) } cancel()