diff --git a/internal/dnsforward/dnsforward_test.go b/internal/dnsforward/dnsforward_test.go index 798da17c..11275188 100644 --- a/internal/dnsforward/dnsforward_test.go +++ b/internal/dnsforward/dnsforward_test.go @@ -500,6 +500,8 @@ func TestServerRace(t *testing.T) { } func TestSafeSearch(t *testing.T) { + var upsCalledCounter uint32 + safeSearchConf := filtering.SafeSearchConfig{ Enabled: true, Google: true, @@ -537,6 +539,8 @@ func TestSafeSearch(t *testing.T) { } s := createTestServer(t, filterConf, forwardConf) ups := aghtest.NewUpstreamMock(func(req *dns.Msg) (resp *dns.Msg, err error) { + atomic.AddUint32(&upsCalledCounter, 1) + resp = new(dns.Msg).SetReply(req) resp.Answer = []dns.RR{&dns.A{ Hdr: dns.RR_Header{ @@ -599,7 +603,6 @@ func TestSafeSearch(t *testing.T) { t.Run(tc.host, func(t *testing.T) { req := createTestMessage(tc.host) - // TODO(a.garipov): Create our own helper for this. var reply *dns.Msg reply, err = dns.Exchange(req, addr) require.NoError(t, err) @@ -620,6 +623,10 @@ func TestSafeSearch(t *testing.T) { } }) } + + t.Run("mock_upstream_is_used", func(t *testing.T) { + assert.Positive(t, atomic.LoadUint32(&upsCalledCounter)) + }) } func TestInvalidRequest(t *testing.T) {