aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joe Blow <splack@users.noreply.github.com> 2016-06-12 17:08:16 +1000
committerGravatar Miek Gieben <miek@miek.nl> 2016-06-12 08:08:16 +0100
commit4432f53ce06843507e17310f2a158b72340b5eed (patch)
tree8901728f2ffc20ed287b322ecf425188a6bc3d73
parent2882991000090084176b74b28c3f0bc80cfce1d5 (diff)
downloadcoredns-4432f53ce06843507e17310f2a158b72340b5eed.tar.gz
coredns-4432f53ce06843507e17310f2a158b72340b5eed.tar.zst
coredns-4432f53ce06843507e17310f2a158b72340b5eed.zip
Added some TXT size tests and MX priority test (#169)
-rw-r--r--middleware/etcd/other_test.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/middleware/etcd/other_test.go b/middleware/etcd/other_test.go
index 73b98a642..1aad593bb 100644
--- a/middleware/etcd/other_test.go
+++ b/middleware/etcd/other_test.go
@@ -5,7 +5,9 @@
package etcd
import (
+ "fmt"
"sort"
+ "strings"
"testing"
"github.com/miekg/coredns/middleware"
@@ -63,12 +65,21 @@ var servicesOther = []*msg.Service{
{Host: "a.ipaddr.skydns.test", Mail: true, Key: "a.mx2.skydns.test."},
{Host: "b.ipaddr.skydns.test", Mail: true, Key: "b.mx2.skydns.test."},
+ {Host: "a.ipaddr.skydns.test", Priority: 20, Mail: true, Key: "a.mx3.skydns.test."},
+ {Host: "a.ipaddr.skydns.test", Priority: 30, Mail: true, Key: "b.mx3.skydns.test."},
+
{Host: "172.16.1.1", Key: "a.ipaddr.skydns.test."},
{Host: "172.16.1.2", Key: "b.ipaddr.skydns.test."},
// txt
{Text: "abc", Key: "a1.txt.skydns.test."},
{Text: "abc abc", Key: "a2.txt.skydns.test."},
+ // txt sizes
+ {Text: strings.Repeat("0", 400), Key: "large400.skydns.test."},
+ {Text: strings.Repeat("0", 600), Key: "large600.skydns.test."},
+ {Text: strings.Repeat("0", 2000), Key: "large2000.skydns.test."},
+ //{Text: strings.Repeat("0", 10000), Key: "large10000.skydns.test."},
+ //{Text: strings.Repeat("0", 40000), Key: "large40000.skydns.test."},
// duplicate ip address
{Host: "10.11.11.10", Key: "http.multiport.http.skydns.test.", Port: 80},
@@ -103,6 +114,17 @@ var dnsTestCasesOther = []test.Case{
test.A("b.ipaddr.skydns.test. 300 A 172.16.1.2"),
},
},
+ // different priority, same host
+ {
+ Qname: "mx3.skydns.test.", Qtype: dns.TypeMX,
+ Answer: []dns.RR{
+ test.MX("mx3.skydns.test. 300 IN MX 20 a.ipaddr.skydns.test."),
+ test.MX("mx3.skydns.test. 300 IN MX 30 a.ipaddr.skydns.test."),
+ },
+ Extra: []dns.RR{
+ test.A("a.ipaddr.skydns.test. 300 A 172.16.1.1"),
+ },
+ },
// Txt
{
Qname: "a1.txt.skydns.test.", Qtype: dns.TypeTXT,
@@ -116,6 +138,43 @@ var dnsTestCasesOther = []test.Case{
test.TXT("a2.txt.skydns.test. 300 IN TXT \"abc abc\""),
},
},
+ // Large txt less than 512
+ {
+ Qname: "large400.skydns.test.", Qtype: dns.TypeTXT,
+ Answer: []dns.RR{
+ test.TXT(fmt.Sprintf("large400.skydns.test. 300 IN TXT \"%s\"", strings.Repeat("0", 400))),
+ },
+ },
+ // Large txt greater than 512 (UDP)
+ {
+ Qname: "large600.skydns.test.", Qtype: dns.TypeTXT,
+ Answer: []dns.RR{
+ test.TXT(fmt.Sprintf("large600.skydns.test. 300 IN TXT \"%s\"", strings.Repeat("0", 600))),
+ },
+ },
+ // Large txt greater than 1500 (typical Ethernet)
+ {
+ Qname: "large2000.skydns.test.", Qtype: dns.TypeTXT,
+ Answer: []dns.RR{
+ test.TXT(fmt.Sprintf("large2000.skydns.test. 300 IN TXT \"%s\"", strings.Repeat("0", 2000))),
+ },
+ },
+ /* Looks like github.com/miekg/dns/scan.go:const maxTok = 2048 is the limit
+ // Large txt greater than 9000 (typical jumbo Ethernet)
+ {
+ Qname: "large10000.skydns.test.", Qtype: dns.TypeTXT,
+ Answer: []dns.RR{
+ test.TXT(fmt.Sprintf("large10000.skydns.test. 300 IN TXT \"%s\"", strings.Repeat("0", 10000))),
+ },
+ },
+ // Large txt greater than 32768 (RDLENGTH is unsigned 16 bit int in RFC 1035)
+ {
+ Qname: "large40000.skydns.test.", Qtype: dns.TypeTXT,
+ Answer: []dns.RR{
+ test.TXT(fmt.Sprintf("large40000.skydns.test. 300 IN TXT \"%s\"", strings.Repeat("0", 40000))),
+ },
+ },
+ */
{
Qname: "txt.skydns.test.", Qtype: dns.TypeTXT,
Answer: []dns.RR{