mirror of
https://github.com/coredns/coredns.git
synced 2025-12-12 21:35:11 -05:00
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:
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user