mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
plugin/cache: Add option to adjust SERVFAIL response cache TTL (#5320)
* add servfail cache opt Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
17
plugin/cache/cache_test.go
vendored
17
plugin/cache/cache_test.go
vendored
@@ -258,6 +258,23 @@ func TestCacheZeroTTL(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCacheServfailTTL0(t *testing.T) {
|
||||
c := New()
|
||||
c.minpttl = minTTL
|
||||
c.minnttl = minNTTL
|
||||
c.failttl = 0
|
||||
c.Next = servFailBackend(0)
|
||||
|
||||
req := new(dns.Msg)
|
||||
req.SetQuestion("example.org.", dns.TypeA)
|
||||
ctx := context.TODO()
|
||||
|
||||
c.ServeDNS(ctx, &test.ResponseWriter{}, req)
|
||||
if c.ncache.Len() != 0 {
|
||||
t.Errorf("SERVFAIL response should not have been cached")
|
||||
}
|
||||
}
|
||||
|
||||
func TestServeFromStaleCache(t *testing.T) {
|
||||
c := New()
|
||||
c.Next = ttlBackend(60)
|
||||
|
||||
Reference in New Issue
Block a user