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.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugin/cache/cache_test.go b/plugin/cache/cache_test.go
index 9417a59f6..d839ea1a3 100644
--- a/plugin/cache/cache_test.go
+++ b/plugin/cache/cache_test.go
@@ -191,7 +191,7 @@ func TestCache(t *testing.T) {
c, crr := newTestCache(maxTTL)
- for _, tc := range cacheTestCases {
+ for n, tc := range cacheTestCases {
m := tc.in.Msg()
m = cacheMsg(m, tc)
@@ -204,11 +204,15 @@ func TestCache(t *testing.T) {
crr.set(m, k, mt, c.pttl)
}
- i, _ := c.get(time.Now().UTC(), state, "dns://:53")
+ i := c.getIgnoreTTL(time.Now().UTC(), state, "dns://:53")
ok := i != nil
- if ok != tc.shouldCache {
- t.Errorf("Cached message that should not have been cached: %s", state.Name())
+ if !tc.shouldCache && ok {
+ t.Errorf("Test %d: Cached message that should not have been cached: %s", n, state.Name())
+ continue
+ }
+ if tc.shouldCache && !ok {
+ t.Errorf("Test %d: Did not cache message that should have been cached: %s", n, state.Name())
continue
}