diff options
author | 2018-04-27 19:37:49 +0100 | |
---|---|---|
committer | 2018-04-27 19:37:49 +0100 | |
commit | bfc647d4edf4e6033e5fc6c7a9d4ddce1b3ddd76 (patch) | |
tree | f62a4ec1b8d4a9d7741a27b158ec301516ae2e79 /plugin/cache/cache_test.go | |
parent | 85f549b529c91da1ab5bf133b0b4ddf429bbc022 (diff) | |
download | coredns-bfc647d4edf4e6033e5fc6c7a9d4ddce1b3ddd76.tar.gz coredns-bfc647d4edf4e6033e5fc6c7a9d4ddce1b3ddd76.tar.zst coredns-bfc647d4edf4e6033e5fc6c7a9d4ddce1b3ddd76.zip |
Cache metrics server (#1746)
* plugin/cache: per server metrics
Use per server metrics in the cache plugin as well. This required
some plumbing changes. Also use request.Request more.
* fix cherry-pick
Diffstat (limited to 'plugin/cache/cache_test.go')
-rw-r--r-- | plugin/cache/cache_test.go | 13 |
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 } |