diff options
Diffstat (limited to 'test/file_cname_proxy_test.go')
-rw-r--r-- | test/file_cname_proxy_test.go | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/test/file_cname_proxy_test.go b/test/file_cname_proxy_test.go index 6d086e091..e6f41ee97 100644 --- a/test/file_cname_proxy_test.go +++ b/test/file_cname_proxy_test.go @@ -3,10 +3,6 @@ package test import ( "testing" - "github.com/coredns/coredns/plugin/proxy" - "github.com/coredns/coredns/plugin/test" - "github.com/coredns/coredns/request" - "github.com/miekg/dns" ) @@ -30,10 +26,9 @@ func TestZoneExternalCNAMELookupWithoutProxy(t *testing.T) { } defer i.Stop() - p := proxy.NewLookup([]string{udp}) - state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} - - resp, err := p.Lookup(state, "cname.example.org.", dns.TypeA) + m := new(dns.Msg) + m.SetQuestion("cname.example.org.", dns.TypeA) + resp, err := dns.Exchange(m, udp) if err != nil { t.Fatalf("Expected to receive reply, but didn't: %s", err) } @@ -52,11 +47,12 @@ func TestZoneExternalCNAMELookupWithProxy(t *testing.T) { } defer rm() - // Corefile with for example without proxy section. - corefile := `example.org:0 { - file ` + name + ` { - upstream 8.8.8.8 + // Corefile with for example proxy section. + corefile := `.:0 { + file ` + name + ` example.org { + upstream } + proxy . 8.8.8.8 8.8.4.4 } ` i, udp, _, err := CoreDNSServerAndPorts(corefile) @@ -65,10 +61,9 @@ func TestZoneExternalCNAMELookupWithProxy(t *testing.T) { } defer i.Stop() - p := proxy.NewLookup([]string{udp}) - state := request.Request{W: &test.ResponseWriter{}, Req: new(dns.Msg)} - - resp, err := p.Lookup(state, "cname.example.org.", dns.TypeA) + m := new(dns.Msg) + m.SetQuestion("cname.example.org.", dns.TypeA) + resp, err := dns.Exchange(m, udp) if err != nil { t.Fatalf("Expected to receive reply, but didn't: %s", err) } |