From ce743a35eff5271cb13a892373536ae815a74ebb Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Wed, 2 Oct 2024 21:13:02 +0300 Subject: [PATCH] dnsforward: fix test --- internal/dnsforward/dnsforward_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/dnsforward/dnsforward_test.go b/internal/dnsforward/dnsforward_test.go index f56e90df..341c29fe 100644 --- a/internal/dnsforward/dnsforward_test.go +++ b/internal/dnsforward/dnsforward_test.go @@ -584,7 +584,13 @@ func TestSafeSearch(t *testing.T) { req := createTestMessage(tc.host) var reply *dns.Msg + + // Use a mutex, since require.Eventually uses goroutines. + mu := &sync.Mutex{} require.Eventually(t, func() (ok bool) { + mu.Lock() + defer mu.Unlock() + reply, _, err = client.Exchange(req, addr) return err == nil