From 05d4602a684fd8049eebeef4b9dfdbea116b54f4 Mon Sep 17 00:00:00 2001 From: Erik Dubbelboer Date: Sat, 16 May 2020 11:54:57 +0200 Subject: [PATCH] Fix race condition in test --- client_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client_test.go b/client_test.go index 3f9bc77..9b5fafc 100644 --- a/client_test.go +++ b/client_test.go @@ -2295,6 +2295,10 @@ func TestHostClientMaxConnWaitTimeoutError(t *testing.T) { } wg.Wait() + // Prevent a race condition with the conns cleaner that might still be running. + c.connsLock.Lock() + defer c.connsLock.Unlock() + if c.connsWait.len() > 0 { t.Errorf("connsWait has %v items remaining", c.connsWait.len()) }