middleware/file: fix delegations (#376)

Fix the delegation handling in the *file* and *dnssec* middleware.
Refactor tests a bit and show that they are failling.

Add a Tree printer, cleanups and tests.
Fix wildcard test - should get no answer from empty-non-terminal
This commit is contained in:
Miek Gieben
2016-11-05 14:39:49 +00:00
committed by GitHub
parent d6902cd7a1
commit 2cca527d9f
18 changed files with 658 additions and 624 deletions

View File

@@ -3,8 +3,6 @@ package file
import (
"strings"
"testing"
"github.com/miekg/dns"
)
func TestClosestEncloser(t *testing.T) {
@@ -26,9 +24,15 @@ func TestClosestEncloser(t *testing.T) {
}
for _, tc := range tests {
ce := z.ClosestEncloser(tc.in, dns.TypeA)
if ce != tc.out {
t.Errorf("expected ce to be %s for %s, got %s", tc.out, tc.in, ce)
ce, _ := z.ClosestEncloser(tc.in)
if ce == nil {
if z.origin != tc.out {
t.Errorf("Expected ce to be %s for %s, got %s", tc.out, tc.in, ce.Name())
}
continue
}
if ce.Name() != tc.out {
t.Errorf("Expected ce to be %s for %s, got %s", tc.out, tc.in, ce.Name())
}
}
}