Make all tests fully qualified

This commit is contained in:
Miek Gieben 2012-01-08 15:34:42 +01:00
parent 9dbfa8a443
commit e522a6daf7
4 changed files with 9 additions and 8 deletions

View File

@ -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)

View File

@ -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

3
msg.go
View File

@ -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.

View File

@ -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()