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:
parent
d60ce0c8d4
commit
dded10420b
5 changed files with 78 additions and 2 deletions
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue