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

Function newTestCache

proxy/cache_internal_test.go:39–51  ·  view source on GitHub ↗

newTestCache is a helper that returns new cache and fills its config with given values. If conf is nil, the default configuration will be used.

(tb testing.TB, conf *cacheConfig)

Source from the content-addressed store, hash-verified

37// newTestCache is a helper that returns new cache and fills its config with
38// given values. If conf is nil, the default configuration will be used.
39func newTestCache(tb testing.TB, conf *cacheConfig) (c *cache) {
40 tb.Helper()
41
42 conf = cmp.Or(conf, &cacheConfig{})
43
44 return newCache(&cacheConfig{
45 size: cmp.Or(conf.size, testCacheSize),
46 optimisticTTL: cmp.Or(conf.optimisticTTL, testOptimisticTTL),
47 optimisticMaxAge: cmp.Or(conf.optimisticMaxAge, testOptimisticMaxAge),
48 withECS: conf.withECS,
49 optimistic: conf.optimistic,
50 })
51}
52
53func TestServeCached(t *testing.T) {
54 dnsProxy := mustNew(t, &Config{

Callers 8

TestCache_expiredFunction · 0.85
TestCacheDOFunction · 0.85
TestCacheCNAMEFunction · 0.85
TestCache_uncacheableFunction · 0.85
TestCache_concurrentFunction · 0.85
runMethod · 0.85
TestCache_getWithSubnetFunction · 0.85

Calls 1

newCacheFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…