From e522a6daf7020591be9012971894c34453f40946 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 8 Jan 2012 15:34:42 +0100 Subject: [PATCH] Make all tests fully qualified --- client_test.go | 8 ++++---- dnssec_test.go | 2 +- msg.go | 3 ++- nsec3_test.go | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client_test.go b/client_test.go index f0336c15..4623aeb2 100644 --- a/client_test.go +++ b/client_test.go @@ -7,7 +7,7 @@ import ( func TestClientSync(t *testing.T) { m := new(Msg) - m.SetQuestion("miek.nl", TypeSOA) + m.SetQuestion("miek.nl.", TypeSOA) c := NewClient() r, _ := c.Exchange(m, "85.223.71.124:53") @@ -26,11 +26,11 @@ func helloMiek(w RequestWriter, r *Msg) { } func TestClientASync(t *testing.T) { - HandleQueryFunc("miek.nl", helloMiek) // All queries for miek.nl will be handled by HelloMiek + HandleQueryFunc("miek.nl.", helloMiek) // All queries for miek.nl will be handled by HelloMiek ListenAndQuery(nil, nil) // Detect if this isn't running m := new(Msg) - m.SetQuestion("miek.nl", TypeSOA) + m.SetQuestion("miek.nl.", TypeSOA) c := NewClient() c.Do(m, "85.223.71.124:53") @@ -51,7 +51,7 @@ forever: func TestClientEDNS0(t *testing.T) { m := new(Msg) - m.SetQuestion("miek.nl", TypeDNSKEY) + m.SetQuestion("miek.nl.", TypeDNSKEY) m.SetEdns0(2048, true) //edns.Option = make([]Option, 1) diff --git a/dnssec_test.go b/dnssec_test.go index 4bc39fc7..7e7c82f1 100644 --- a/dnssec_test.go +++ b/dnssec_test.go @@ -246,7 +246,7 @@ func TestKeyRSA(t *testing.T) { func TestKeyToDS(t *testing.T) { key := new(RR_DNSKEY) - key.Hdr.Name = "miek.nl" + key.Hdr.Name = "miek.nl." key.Hdr.Rrtype = TypeDNSKEY key.Hdr.Class = ClassINET key.Hdr.Ttl = 3600 diff --git a/msg.go b/msg.go index ed128954..172036b1 100644 --- a/msg.go +++ b/msg.go @@ -178,7 +178,8 @@ func PackDomainName(s string, msg []byte, off int) (off1 int, ok bool) { // Add trailing dot to canonicalize name. lenmsg := len(msg) if n := len(s); n == 0 || s[n-1] != '.' { - s += "." + return lenmsg, false // This is an error, should be fqdn +// s += "." } // Each dot ends a segment of the name. diff --git a/nsec3_test.go b/nsec3_test.go index c2a5cf6c..37c45484 100644 --- a/nsec3_test.go +++ b/nsec3_test.go @@ -5,13 +5,13 @@ import ( ) func TestPackNsec3(t *testing.T) { - nsec3 := HashName("dnsex.nl", SHA1, 0, "DEAD") + nsec3 := HashName("dnsex.nl.", SHA1, 0, "DEAD") if nsec3 != "ROCCJAE8BJJU7HN6T7NG3TNM8ACRS87J" { t.Logf("%v\n", nsec3) t.Fail() } - nsec3 = HashName("a.b.c.example.org", SHA1, 2, "DEAD") + nsec3 = HashName("a.b.c.example.org.", SHA1, 2, "DEAD") if nsec3 != "6LQ07OAHBTOOEU2R9ANI2AT70K5O0RCG" { t.Logf("%v\n", nsec3) t.Fail()