Add TestServer (#102)
Add a fullblown testing server. This allows us to do integration tests. Also add a basic proxy test. Further tests will test etcd proxy and stub zone communication and other "wildish" configurations. Redo the server startup, so we can access the ports it listens on when it has started up (with dns.ActivateAndServer). Extend the .travis file to download etcd and test for that as well. Put integration tests in test dir
This commit is contained in:
parent
db98cd4e4b
commit
0ea2a6088d
13 changed files with 191 additions and 135 deletions
|
@ -18,7 +18,6 @@ import (
|
|||
coretest "github.com/miekg/coredns/middleware/testing"
|
||||
|
||||
etcdc "github.com/coreos/etcd/client"
|
||||
"github.com/miekg/dns"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -79,36 +78,17 @@ func TestLookup(t *testing.T) {
|
|||
sort.Sort(coretest.RRSet(resp.Ns))
|
||||
sort.Sort(coretest.RRSet(resp.Extra))
|
||||
|
||||
if resp.Rcode != tc.Rcode {
|
||||
t.Errorf("rcode is %q, expected %q", dns.RcodeToString[resp.Rcode], dns.RcodeToString[tc.Rcode])
|
||||
if !coretest.Header(t, tc, resp) {
|
||||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(resp.Answer) != len(tc.Answer) {
|
||||
t.Errorf("answer for %q contained %d results, %d expected", tc.Qname, len(resp.Answer), len(tc.Answer))
|
||||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if len(resp.Ns) != len(tc.Ns) {
|
||||
t.Errorf("authority for %q contained %d results, %d expected", tc.Qname, len(resp.Ns), len(tc.Ns))
|
||||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if len(resp.Extra) != len(tc.Extra) {
|
||||
t.Errorf("additional for %q contained %d results, %d expected", tc.Qname, len(resp.Extra), len(tc.Extra))
|
||||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
|
||||
if !coretest.CheckSection(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !coretest.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !coretest.CheckSection(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !coretest.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
|
||||
}
|
||||
if !coretest.CheckSection(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !coretest.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue