MCPcopy
hub / github.com/AdguardTeam/dnsproxy / TestCache_uncacheable

Function TestCache_uncacheable

proxy/cache_internal_test.go:259–273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

257}
258
259func TestCache_uncacheable(t *testing.T) {
260 testCache := newTestCache(t, nil)
261
262 // Create a DNS request.
263 request := (&dns.Msg{}).SetQuestion("google.com.", dns.TypeA)
264 // Fill the cache.
265 reply := (&dns.Msg{}).SetRcode(request, dns.RcodeBadAlg)
266
267 // We are testing that SERVFAIL responses aren't cached
268 testCache.set(request, reply, upstreamWithAddr, testLogger)
269
270 r, expired, _ := testCache.get(request)
271 assert.Nil(t, r)
272 assert.False(t, expired)
273}
274
275func TestCache_concurrent(t *testing.T) {
276 testCache := newTestCache(t, nil)

Callers

nothing calls this directly

Calls 3

newTestCacheFunction · 0.85
setMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…