diff options
author | 2019-08-30 13:47:27 +0100 | |
---|---|---|
committer | 2019-08-30 13:47:27 +0100 | |
commit | 94930d20ea241fddb5fa1668a08112dc1acc900d (patch) | |
tree | 8a91cab00334def283c63ef1cba2982fcce7dc12 /test | |
parent | b8a0b52a5edc05145588598e7a5e2f00b82bb84d (diff) | |
download | coredns-94930d20ea241fddb5fa1668a08112dc1acc900d.tar.gz coredns-94930d20ea241fddb5fa1668a08112dc1acc900d.tar.zst coredns-94930d20ea241fddb5fa1668a08112dc1acc900d.zip |
plugin/file: rework outgoing axfr (#3227)
* plugin/file: rework outgoing axfr
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix test
Signed-off-by: Miek Gieben <miek@miek.nl>
* Actually properly test xfr
Signed-off-by: Miek Gieben <miek@miek.nl>
* Fix test
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'test')
-rw-r--r-- | test/auto_test.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/auto_test.go b/test/auto_test.go index 4d9b70a1c..07e2af12d 100644 --- a/test/auto_test.go +++ b/test/auto_test.go @@ -129,9 +129,9 @@ func TestAutoAXFR(t *testing.T) { t.Fatalf("Could not get CoreDNS serving instance: %s", err) } - udp, _ := CoreDNSServerPorts(i, 0) - if udp == "" { - t.Fatal("Could not get UDP listening port") + _, tcp := CoreDNSServerPorts(i, 0) + if tcp == "" { + t.Fatal("Could not get TCP listening port") } defer i.Stop() @@ -142,14 +142,20 @@ func TestAutoAXFR(t *testing.T) { time.Sleep(1100 * time.Millisecond) // wait for it to be picked up + tr := new(dns.Transfer) m := new(dns.Msg) m.SetAxfr("example.org.") - resp, err := dns.Exchange(m, udp) + c, err := tr.In(m, tcp) if err != nil { t.Fatal("Expected to receive reply, but didn't") } - if len(resp.Answer) != 5 { - t.Fatalf("Expected response with %d RRs, got %d", 5, len(resp.Answer)) + l := 0 + for e := range c { + l += len(e.RR) + } + + if l != 5 { + t.Fatalf("Expected response with %d RRs, got %d", 5, l) } } |