aboutsummaryrefslogtreecommitdiff
path: root/middleware/etcd/debug_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-08-08 19:18:55 -0700
committerGravatar GitHub <noreply@github.com> 2016-08-08 19:18:55 -0700
commitad76aef5fcf46dcdb50d8529bbf085a1578d3bda (patch)
treec662253762ad5f7ad1c4223023b2b1f1bba6b732 /middleware/etcd/debug_test.go
parentc079de65b520bd7690c7ac057a38b404947f3909 (diff)
downloadcoredns-ad76aef5fcf46dcdb50d8529bbf085a1578d3bda.tar.gz
coredns-ad76aef5fcf46dcdb50d8529bbf085a1578d3bda.tar.zst
coredns-ad76aef5fcf46dcdb50d8529bbf085a1578d3bda.zip
Fix stubzone retention (#198)
Make the receiver a pointer so that the uptdateStubZones map update will retain the stubzones found, unlike the current case where the update will be applied and then promptly forgotten, because it is working on a copy. Add test/etcd_test.go to test a large part of the code. This didn't catch the chaos middleware hack though. The chaos middleware zones are now *not* automatically added. You have to take care of that by yourself (docs updates). When using debug queries and falling through to the next middleware in etcd, restore the original (with o-o.debug) query before passing it on.
Diffstat (limited to 'middleware/etcd/debug_test.go')
-rw-r--r--middleware/etcd/debug_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/middleware/etcd/debug_test.go b/middleware/etcd/debug_test.go
index d07ffe986..91796816f 100644
--- a/middleware/etcd/debug_test.go
+++ b/middleware/etcd/debug_test.go
@@ -4,6 +4,7 @@ package etcd
import (
"sort"
+ "strings"
"testing"
"github.com/miekg/coredns/middleware"
@@ -13,17 +14,17 @@ import (
"github.com/miekg/dns"
)
-func TestisDebug(t *testing.T) {
+func TestIsDebug(t *testing.T) {
if ok := isDebug("o-o.debug.miek.nl."); ok != "miek.nl." {
t.Errorf("expected o-o.debug.miek.nl. to be debug")
}
- if ok := isDebug("o-o.Debug.miek.nl."); ok != "miek.nl." {
+ if ok := isDebug(strings.ToLower("o-o.Debug.miek.nl.")); ok != "miek.nl." {
t.Errorf("expected o-o.Debug.miek.nl. to be debug")
}
- if ok := isDebug("i-o.Debug.miek.nl."); ok != "" {
+ if ok := isDebug("i-o.debug.miek.nl."); ok != "" {
t.Errorf("expected i-o.Debug.miek.nl. to be non-debug")
}
- if ok := isDebug("i-o.Debug."); ok != "" {
+ if ok := isDebug(strings.ToLower("i-o.Debug.")); ok != "" {
t.Errorf("expected o-o.Debug. to be non-debug")
}
}
@@ -35,6 +36,7 @@ func TestDebugLookup(t *testing.T) {
}
etc.Debug = true
defer func() { etc.Debug = false }()
+
for _, tc := range dnsTestCasesDebug {
m := tc.Msg()