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)
| 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. |
| 39 | func 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 | |
| 53 | func TestServeCached(t *testing.T) { |
| 54 | dnsProxy := mustNew(t, &Config{ |
no test coverage detected
searching dependent graphs…