aboutsummaryrefslogtreecommitdiff
path: root/test/auto_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/auto_test.go')
-rw-r--r--test/auto_test.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/test/auto_test.go b/test/auto_test.go
index c45aed4fa..9380ea78a 100644
--- a/test/auto_test.go
+++ b/test/auto_test.go
@@ -7,10 +7,6 @@ import (
"testing"
"time"
- "github.com/coredns/coredns/plugin/proxy"
- "github.com/coredns/coredns/plugin/test"
- "github.com/coredns/coredns/request"
-
"github.com/miekg/dns"
)
@@ -34,10 +30,9 @@ func TestAuto(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, "www.example.org.", dns.TypeA)
+ m := new(dns.Msg)
+ m.SetQuestion("www.example.org.", dns.TypeA)
+ resp, err := dns.Exchange(m, udp)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
}
@@ -52,7 +47,7 @@ func TestAuto(t *testing.T) {
time.Sleep(1500 * time.Millisecond) // wait for it to be picked up
- resp, err = p.Lookup(state, "www.example.org.", dns.TypeA)
+ resp, err = dns.Exchange(m, udp)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
}
@@ -64,7 +59,7 @@ func TestAuto(t *testing.T) {
os.Remove(filepath.Join(tmpdir, "db.example.org"))
time.Sleep(1100 * time.Millisecond) // wait for it to be picked up
- resp, err = p.Lookup(state, "www.example.org.", dns.TypeA)
+ resp, err = dns.Exchange(m, udp)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
}
@@ -99,10 +94,9 @@ func TestAutoNonExistentZone(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, "example.org.", dns.TypeA)
+ m := new(dns.Msg)
+ m.SetQuestion("example.org.", dns.TypeA)
+ resp, err := dns.Exchange(m, udp)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
}
@@ -145,12 +139,9 @@ func TestAutoAXFR(t *testing.T) {
time.Sleep(1100 * time.Millisecond) // wait for it to be picked up
- p := proxy.NewLookup([]string{udp})
m := new(dns.Msg)
m.SetAxfr("example.org.")
- state := request.Request{W: &test.ResponseWriter{}, Req: m}
-
- resp, err := p.Lookup(state, "example.org.", dns.TypeAXFR)
+ resp, err := dns.Exchange(m, udp)
if err != nil {
t.Fatal("Expected to receive reply, but didn't")
}