Fix resolving CNAME with no proxy (#564)

This fixes a crash when we resolve (or try to) an external CNAME
when no proxy is set.

Add test as well.
This commit is contained in:
Miek Gieben 2017-03-02 19:35:44 +00:00 committed by GitHub
parent a3f7788686
commit 6966bce653
11 changed files with 67 additions and 9 deletions

View file

@ -9,6 +9,7 @@ import (
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
)
@ -18,7 +19,7 @@ func TestZoneReload(t *testing.T) {
name, rm, err := TempFile(".", exampleOrg)
if err != nil {
t.Fatalf("Failed to created zone: %s", err)
t.Fatalf("Failed to create zone: %s", err)
}
defer rm()
@ -47,7 +48,7 @@ example.net:0 {
resp, err := p.Lookup(state, "example.org.", dns.TypeA)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
t.Fatalf("Expected to receive reply, but didn't: %s", err)
}
if len(resp.Answer) != 2 {
t.Fatalf("Expected two RR in answer section got %d", len(resp.Answer))