aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/cache_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-02-16 09:43:22 +0100
committerGravatar GitHub <noreply@github.com> 2018-02-16 09:43:22 +0100
commitfc1d73ffa9ae193c4cfca4adc194ae43f9360dbb (patch)
treeec08dd8896a2b0e1d73f88aabae6310c67b02fa6 /plugin/cache/cache_test.go
parentf10627c1d61518b33c658db64c8b8b1bc6a914cb (diff)
downloadcoredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.tar.gz
coredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.tar.zst
coredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.zip
pkg/typify: empty messages are OtherError (#1531)
Messages with nothing in them are considered OtherError, they can not serve any purpose for normal clients (i.e. dyn update or notifies might have a use for them). Also update a test in the cache plugin, so that we explicitaly test for this case.
Diffstat (limited to 'plugin/cache/cache_test.go')
-rw-r--r--plugin/cache/cache_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/cache/cache_test.go b/plugin/cache/cache_test.go
index b475f3473..63b0989b3 100644
--- a/plugin/cache/cache_test.go
+++ b/plugin/cache/cache_test.go
@@ -22,6 +22,7 @@ type cacheTestCase struct {
Authoritative bool
RecursionAvailable bool
Truncated bool
+ Response bool
shouldCache bool
}
@@ -112,6 +113,15 @@ var cacheTestCases = []cacheTestCase{
shouldCache: false,
},
{
+ // Response with only something in the additional, this should not be cached.
+ Response: true,
+ in: test.Case{
+ Qname: "example.org.", Qtype: dns.TypeMX,
+ Extra: []dns.RR{test.MX("example.org. 1800 IN MX 1 mx.example.org.")},
+ },
+ shouldCache: false,
+ },
+ {
RecursionAvailable: true, Authoritative: true,
Case: test.Case{
Qname: "example.org.", Qtype: dns.TypeMX,
@@ -140,6 +150,7 @@ func cacheMsg(m *dns.Msg, tc cacheTestCase) *dns.Msg {
m.AuthenticatedData = tc.AuthenticatedData
m.Authoritative = tc.Authoritative
m.Rcode = tc.Rcode
+ m.Response = tc.Response
m.Truncated = tc.Truncated
m.Answer = tc.in.Answer
m.Ns = tc.in.Ns