Make all tests fully qualified
This commit is contained in:
parent
9dbfa8a443
commit
e522a6daf7
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
func TestClientSync(t *testing.T) {
|
func TestClientSync(t *testing.T) {
|
||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.SetQuestion("miek.nl", TypeSOA)
|
m.SetQuestion("miek.nl.", TypeSOA)
|
||||||
|
|
||||||
c := NewClient()
|
c := NewClient()
|
||||||
r, _ := c.Exchange(m, "85.223.71.124:53")
|
r, _ := c.Exchange(m, "85.223.71.124:53")
|
||||||
|
@ -26,11 +26,11 @@ func helloMiek(w RequestWriter, r *Msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestClientASync(t *testing.T) {
|
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
|
ListenAndQuery(nil, nil) // Detect if this isn't running
|
||||||
|
|
||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.SetQuestion("miek.nl", TypeSOA)
|
m.SetQuestion("miek.nl.", TypeSOA)
|
||||||
|
|
||||||
c := NewClient()
|
c := NewClient()
|
||||||
c.Do(m, "85.223.71.124:53")
|
c.Do(m, "85.223.71.124:53")
|
||||||
|
@ -51,7 +51,7 @@ forever:
|
||||||
|
|
||||||
func TestClientEDNS0(t *testing.T) {
|
func TestClientEDNS0(t *testing.T) {
|
||||||
m := new(Msg)
|
m := new(Msg)
|
||||||
m.SetQuestion("miek.nl", TypeDNSKEY)
|
m.SetQuestion("miek.nl.", TypeDNSKEY)
|
||||||
|
|
||||||
m.SetEdns0(2048, true)
|
m.SetEdns0(2048, true)
|
||||||
//edns.Option = make([]Option, 1)
|
//edns.Option = make([]Option, 1)
|
||||||
|
|
|
@ -246,7 +246,7 @@ func TestKeyRSA(t *testing.T) {
|
||||||
|
|
||||||
func TestKeyToDS(t *testing.T) {
|
func TestKeyToDS(t *testing.T) {
|
||||||
key := new(RR_DNSKEY)
|
key := new(RR_DNSKEY)
|
||||||
key.Hdr.Name = "miek.nl"
|
key.Hdr.Name = "miek.nl."
|
||||||
key.Hdr.Rrtype = TypeDNSKEY
|
key.Hdr.Rrtype = TypeDNSKEY
|
||||||
key.Hdr.Class = ClassINET
|
key.Hdr.Class = ClassINET
|
||||||
key.Hdr.Ttl = 3600
|
key.Hdr.Ttl = 3600
|
||||||
|
|
3
msg.go
3
msg.go
|
@ -178,7 +178,8 @@ func PackDomainName(s string, msg []byte, off int) (off1 int, ok bool) {
|
||||||
// Add trailing dot to canonicalize name.
|
// Add trailing dot to canonicalize name.
|
||||||
lenmsg := len(msg)
|
lenmsg := len(msg)
|
||||||
if n := len(s); n == 0 || s[n-1] != '.' {
|
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.
|
// Each dot ends a segment of the name.
|
||||||
|
|
|
@ -5,13 +5,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPackNsec3(t *testing.T) {
|
func TestPackNsec3(t *testing.T) {
|
||||||
nsec3 := HashName("dnsex.nl", SHA1, 0, "DEAD")
|
nsec3 := HashName("dnsex.nl.", SHA1, 0, "DEAD")
|
||||||
if nsec3 != "ROCCJAE8BJJU7HN6T7NG3TNM8ACRS87J" {
|
if nsec3 != "ROCCJAE8BJJU7HN6T7NG3TNM8ACRS87J" {
|
||||||
t.Logf("%v\n", nsec3)
|
t.Logf("%v\n", nsec3)
|
||||||
t.Fail()
|
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" {
|
if nsec3 != "6LQ07OAHBTOOEU2R9ANI2AT70K5O0RCG" {
|
||||||
t.Logf("%v\n", nsec3)
|
t.Logf("%v\n", nsec3)
|
||||||
t.Fail()
|
t.Fail()
|
||||||
|
|
Loading…
Reference in New Issue