Implement external lookups for CNAMEs

This commit is contained in:
Miek Gieben 2016-11-10 07:48:47 +00:00
parent 0919216d3c
commit d383f279a0
7 changed files with 39 additions and 16 deletions

View file

@ -8,6 +8,7 @@ import (
"time"
"github.com/miekg/coredns/middleware/test"
"github.com/miekg/coredns/request"
"github.com/miekg/dns"
)
@ -31,11 +32,17 @@ func TestZoneReload(t *testing.T) {
z.Reload()
if _, _, _, res := z.Lookup("miek.nl.", dns.TypeSOA, false); res != Success {
r := new(dns.Msg)
r.SetQuestion("miek.nl", dns.TypeSOA)
state := request.Request{W: &test.ResponseWriter{}, Req: r}
if _, _, _, res := z.Lookup(state, "miek.nl."); res != Success {
t.Fatalf("failed to lookup, got %d", res)
}
if _, _, _, res := z.Lookup("miek.nl.", dns.TypeNS, false); res != Success {
r = new(dns.Msg)
r.SetQuestion("miek.nl", dns.TypeNS)
state = request.Request{W: &test.ResponseWriter{}, Req: r}
if _, _, _, res := z.Lookup(state, "miek.nl."); res != Success {
t.Fatalf("failed to lookup, got %d", res)
}