better (#104)
This commit is contained in:
parent
fed51ea373
commit
31ce53f514
6 changed files with 60 additions and 60 deletions
|
@ -35,13 +35,13 @@ func TestCnameLookup(t *testing.T) {
|
|||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !test.Section(t, tc, test.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !test.Section(t, tc, test.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !test.Section(t, tc, test.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ func TestGroupLookup(t *testing.T) {
|
|||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !test.Section(t, tc, test.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !test.Section(t, tc, test.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !test.Section(t, tc, test.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ package etcd
|
|||
|
||||
import (
|
||||
"github.com/miekg/coredns/middleware/etcd/msg"
|
||||
"github.com/miekg/coredns/middleware/testing"
|
||||
"github.com/miekg/coredns/middleware/test"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
@ -32,87 +32,87 @@ var services = []*msg.Service{
|
|||
{Host: "b.cname.skydns.test", Key: "a.cname.skydns.test."},
|
||||
}
|
||||
|
||||
var dnsTestCases = []testing.Case{
|
||||
var dnsTestCases = []test.Case{
|
||||
// SRV Test
|
||||
{
|
||||
Qname: "a.server1.dev.region1.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{testing.SRV("a.server1.dev.region1.skydns.test. 300 SRV 10 100 8080 dev.server1.")},
|
||||
Answer: []dns.RR{test.SRV("a.server1.dev.region1.skydns.test. 300 SRV 10 100 8080 dev.server1.")},
|
||||
},
|
||||
// SRV Test (case test)
|
||||
{
|
||||
Qname: "a.SERVer1.dEv.region1.skydns.tEst.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{testing.SRV("a.SERVer1.dEv.region1.skydns.tEst. 300 SRV 10 100 8080 dev.server1.")},
|
||||
Answer: []dns.RR{test.SRV("a.SERVer1.dEv.region1.skydns.tEst. 300 SRV 10 100 8080 dev.server1.")},
|
||||
},
|
||||
// NXDOMAIN Test
|
||||
{
|
||||
Qname: "doesnotexist.skydns.test.", Qtype: dns.TypeA,
|
||||
Rcode: dns.RcodeNameError,
|
||||
Ns: []dns.RR{
|
||||
testing.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0"),
|
||||
test.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0"),
|
||||
},
|
||||
},
|
||||
// A Test
|
||||
{
|
||||
Qname: "a.server1.prod.region1.skydns.test.", Qtype: dns.TypeA,
|
||||
Answer: []dns.RR{testing.A("a.server1.prod.region1.skydns.test. 300 A 10.0.0.1")},
|
||||
Answer: []dns.RR{test.A("a.server1.prod.region1.skydns.test. 300 A 10.0.0.1")},
|
||||
},
|
||||
// SRV Test where target is IP address
|
||||
{
|
||||
Qname: "a.server1.prod.region1.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{testing.SRV("a.server1.prod.region1.skydns.test. 300 SRV 10 100 8080 a.server1.prod.region1.skydns.test.")},
|
||||
Extra: []dns.RR{testing.A("a.server1.prod.region1.skydns.test. 300 A 10.0.0.1")},
|
||||
Answer: []dns.RR{test.SRV("a.server1.prod.region1.skydns.test. 300 SRV 10 100 8080 a.server1.prod.region1.skydns.test.")},
|
||||
Extra: []dns.RR{test.A("a.server1.prod.region1.skydns.test. 300 A 10.0.0.1")},
|
||||
},
|
||||
// AAAA Test
|
||||
{
|
||||
Qname: "b.server6.prod.region1.skydns.test.", Qtype: dns.TypeAAAA,
|
||||
Answer: []dns.RR{testing.AAAA("b.server6.prod.region1.skydns.test. 300 AAAA ::1")},
|
||||
Answer: []dns.RR{test.AAAA("b.server6.prod.region1.skydns.test. 300 AAAA ::1")},
|
||||
},
|
||||
// Multiple A Record Test
|
||||
{
|
||||
Qname: "server1.prod.region1.skydns.test.", Qtype: dns.TypeA,
|
||||
Answer: []dns.RR{
|
||||
testing.A("server1.prod.region1.skydns.test. 300 A 10.0.0.1"),
|
||||
testing.A("server1.prod.region1.skydns.test. 300 A 10.0.0.2"),
|
||||
test.A("server1.prod.region1.skydns.test. 300 A 10.0.0.1"),
|
||||
test.A("server1.prod.region1.skydns.test. 300 A 10.0.0.2"),
|
||||
},
|
||||
},
|
||||
// Priority Test
|
||||
{
|
||||
Qname: "priority.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{testing.SRV("priority.skydns.test. 300 SRV 333 100 8080 priority.server1.")},
|
||||
Answer: []dns.RR{test.SRV("priority.skydns.test. 300 SRV 333 100 8080 priority.server1.")},
|
||||
},
|
||||
// Subdomain Test
|
||||
{
|
||||
Qname: "sub.region1.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{
|
||||
testing.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 0 sub.server1."),
|
||||
testing.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 80 sub.server2."),
|
||||
testing.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 8080 c.sub.region1.skydns.test."),
|
||||
test.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 0 sub.server1."),
|
||||
test.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 80 sub.server2."),
|
||||
test.SRV("sub.region1.skydns.test. 300 IN SRV 10 33 8080 c.sub.region1.skydns.test."),
|
||||
},
|
||||
Extra: []dns.RR{testing.A("c.sub.region1.skydns.test. 300 IN A 10.0.0.1")},
|
||||
Extra: []dns.RR{test.A("c.sub.region1.skydns.test. 300 IN A 10.0.0.1")},
|
||||
},
|
||||
// CNAME (unresolvable internal name)
|
||||
{
|
||||
Qname: "cname.prod.region1.skydns.test.", Qtype: dns.TypeA,
|
||||
Ns: []dns.RR{testing.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0")},
|
||||
Ns: []dns.RR{test.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0")},
|
||||
},
|
||||
// Wildcard Test
|
||||
{
|
||||
Qname: "*.region1.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 0 sub.server1."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 0 unresolvable.skydns.test."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 80 sub.server2."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 a.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 b.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 b.server6.prod.region1.skydns.test."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 c.sub.region1.skydns.test."),
|
||||
testing.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 dev.server1."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 0 sub.server1."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 0 unresolvable.skydns.test."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 80 sub.server2."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 a.server1.prod.region1.skydns.test."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 b.server1.prod.region1.skydns.test."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 b.server6.prod.region1.skydns.test."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 c.sub.region1.skydns.test."),
|
||||
test.SRV("*.region1.skydns.test. 300 IN SRV 10 12 8080 dev.server1."),
|
||||
},
|
||||
Extra: []dns.RR{
|
||||
testing.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
testing.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
testing.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
testing.A("c.sub.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
test.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
test.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
test.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
test.A("c.sub.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
},
|
||||
},
|
||||
// Wildcard Test
|
||||
|
@ -120,40 +120,40 @@ var dnsTestCases = []testing.Case{
|
|||
Qname: "prod.*.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{
|
||||
|
||||
testing.SRV("prod.*.skydns.test. 300 IN SRV 10 25 0 unresolvable.skydns.test."),
|
||||
testing.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 a.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 b.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 b.server6.prod.region1.skydns.test."),
|
||||
test.SRV("prod.*.skydns.test. 300 IN SRV 10 25 0 unresolvable.skydns.test."),
|
||||
test.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 a.server1.prod.region1.skydns.test."),
|
||||
test.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 b.server1.prod.region1.skydns.test."),
|
||||
test.SRV("prod.*.skydns.test. 300 IN SRV 10 25 8080 b.server6.prod.region1.skydns.test."),
|
||||
},
|
||||
Extra: []dns.RR{
|
||||
testing.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
testing.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
testing.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
test.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
test.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
test.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
},
|
||||
},
|
||||
// Wildcard Test
|
||||
{
|
||||
Qname: "prod.any.skydns.test.", Qtype: dns.TypeSRV,
|
||||
Answer: []dns.RR{
|
||||
testing.SRV("prod.any.skydns.test. 300 IN SRV 10 25 0 unresolvable.skydns.test."),
|
||||
testing.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 a.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 b.server1.prod.region1.skydns.test."),
|
||||
testing.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 b.server6.prod.region1.skydns.test."),
|
||||
test.SRV("prod.any.skydns.test. 300 IN SRV 10 25 0 unresolvable.skydns.test."),
|
||||
test.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 a.server1.prod.region1.skydns.test."),
|
||||
test.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 b.server1.prod.region1.skydns.test."),
|
||||
test.SRV("prod.any.skydns.test. 300 IN SRV 10 25 8080 b.server6.prod.region1.skydns.test."),
|
||||
},
|
||||
Extra: []dns.RR{
|
||||
testing.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
testing.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
testing.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
test.A("a.server1.prod.region1.skydns.test. 300 IN A 10.0.0.1"),
|
||||
test.A("b.server1.prod.region1.skydns.test. 300 IN A 10.0.0.2"),
|
||||
test.AAAA("b.server6.prod.region1.skydns.test. 300 IN AAAA ::1"),
|
||||
},
|
||||
},
|
||||
// CNAME loop detection
|
||||
{
|
||||
Qname: "a.cname.skydns.test.", Qtype: dns.TypeA,
|
||||
Ns: []dns.RR{testing.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 1407441600 28800 7200 604800 60")},
|
||||
Ns: []dns.RR{test.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 1407441600 28800 7200 604800 60")},
|
||||
},
|
||||
// NODATA Test
|
||||
{
|
||||
Qname: "a.server1.dev.region1.skydns.test.", Qtype: dns.TypeTXT,
|
||||
Ns: []dns.RR{testing.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0")},
|
||||
Ns: []dns.RR{test.SOA("skydns.test. 300 SOA ns.dns.skydns.test. hostmaster.skydns.test. 0 0 0 0 0")},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -44,13 +44,13 @@ func TestMultiLookup(t *testing.T) {
|
|||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !test.Section(t, tc, test.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !test.Section(t, tc, test.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !test.Section(t, tc, test.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,13 @@ func TestOtherLookup(t *testing.T) {
|
|||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !test.Section(t, tc, test.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !test.Section(t, tc, test.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !test.Section(t, tc, test.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,13 +82,13 @@ func TestLookup(t *testing.T) {
|
|||
t.Logf("%v\n", resp)
|
||||
continue
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Answer, resp.Answer) {
|
||||
if !test.Section(t, tc, test.Answer, resp.Answer) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Ns, resp.Ns) {
|
||||
if !test.Section(t, tc, test.Ns, resp.Ns) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
if !test.Section(t, tc, coretest.Extra, resp.Extra) {
|
||||
if !test.Section(t, tc, test.Extra, resp.Extra) {
|
||||
t.Logf("%v\n", resp)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue