From 2909827c57b79a4e4aa3fa7bd56affcba6fb6b8e Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sun, 2 Jun 2024 12:29:30 +0200 Subject: [PATCH] Fix another flaky test --- server_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server_test.go b/server_test.go index c17c89f..f847ab5 100644 --- a/server_test.go +++ b/server_test.go @@ -1047,6 +1047,11 @@ func TestRejectedRequestsCount(t *testing.T) { } } + // The server's worker pool is a separate goroutine, give it + // a little bit of time to process the failed connection, + // otherwise the test may fail from time to time. + time.Sleep(time.Millisecond * 10) + if cnt := s.GetRejectedConnectionsCount(); cnt != uint32(expectedCount) { t.Errorf("unexpected rejected connections count: %d. Expecting %d", cnt, expectedCount)