dnsforward: fix test

This commit is contained in:
Ainar Garipov 2024-10-02 21:13:02 +03:00
parent 355cec1d7b
commit ce743a35ef
1 changed files with 6 additions and 0 deletions

View File

@ -584,7 +584,13 @@ func TestSafeSearch(t *testing.T) {
req := createTestMessage(tc.host) req := createTestMessage(tc.host)
var reply *dns.Msg var reply *dns.Msg
// Use a mutex, since require.Eventually uses goroutines.
mu := &sync.Mutex{}
require.Eventually(t, func() (ok bool) { require.Eventually(t, func() (ok bool) {
mu.Lock()
defer mu.Unlock()
reply, _, err = client.Exchange(req, addr) reply, _, err = client.Exchange(req, addr)
return err == nil return err == nil