aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/cache_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/cache/cache_test.go')
-rw-r--r--plugin/cache/cache_test.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugin/cache/cache_test.go b/plugin/cache/cache_test.go
index 131803ea7..812dd2b36 100644
--- a/plugin/cache/cache_test.go
+++ b/plugin/cache/cache_test.go
@@ -8,6 +8,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/response"
"github.com/coredns/coredns/plugin/test"
+ "github.com/coredns/coredns/request"
"github.com/miekg/dns"
)
@@ -162,21 +163,19 @@ func TestCache(t *testing.T) {
for _, tc := range cacheTestCases {
m := tc.in.Msg()
m = cacheMsg(m, tc)
- do := tc.in.Do
+
+ state := request.Request{W: nil, Req: m}
mt, _ := response.Typify(m, utc)
- k := key(m, mt, do)
+ k := key(m, mt, state.Do())
crr.set(m, k, mt, c.pttl)
- name := plugin.Name(m.Question[0].Name).Normalize()
- qtype := m.Question[0].Qtype
-
- i, _ := c.get(time.Now().UTC(), name, qtype, do)
+ i, _ := c.get(time.Now().UTC(), state, "dns://:53")
ok := i != nil
if ok != tc.shouldCache {
- t.Errorf("cached message that should not have been cached: %s", name)
+ t.Errorf("cached message that should not have been cached: %s", state.Name())
continue
}