Fix the tests + gofmt
This commit is contained in:
parent
dad5761301
commit
fa8a5e5757
|
@ -10,7 +10,7 @@ func TestClientSync(t *testing.T) {
|
|||
m.SetQuestion("miek.nl.", TypeSOA)
|
||||
|
||||
c := new(Client)
|
||||
r, _ := c.Exchange(m, "85.223.71.124:53")
|
||||
r, _, _ := c.Exchange(m, "85.223.71.124:53")
|
||||
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Log("Failed to get an valid answer")
|
||||
|
@ -24,13 +24,17 @@ func TestClientASync(t *testing.T) {
|
|||
m.SetQuestion("miek.nl.", TypeSOA)
|
||||
|
||||
c := new(Client)
|
||||
c.Do(m, "85.223.71.124:53", nil, func(m, r *Msg, e error, d interface{}) {
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Log("Failed to get an valid answer")
|
||||
t.Fail()
|
||||
t.Logf("%v\n", r)
|
||||
}
|
||||
})
|
||||
ch := c.Do(m, "85.223.71.124:53", nil)
|
||||
|
||||
/*
|
||||
func(m, r *Msg, e error, d interface{}) {
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Log("Failed to get an valid answer")
|
||||
t.Fail()
|
||||
t.Logf("%v\n", r)
|
||||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
func TestClientEDNS0(t *testing.T) {
|
||||
|
@ -42,7 +46,7 @@ func TestClientEDNS0(t *testing.T) {
|
|||
//edns.SetNsid("") // Empty to request it
|
||||
|
||||
c := new(Client)
|
||||
r, _ := c.Exchange(m, "85.223.71.124:53")
|
||||
r, _, _ := c.Exchange(m, "85.223.71.124:53")
|
||||
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Log("Failed to get an valid answer")
|
||||
|
|
|
@ -11,7 +11,7 @@ func ExampleRR_MX() {
|
|||
m := new(Msg)
|
||||
m.SetQuestion("miek.nl.", TypeMX)
|
||||
m.RecursionDesired = true
|
||||
r, err := c.Exchange(m, config.Servers[0]+":"+config.Port)
|
||||
r, _, err := c.Exchange(m, config.Servers[0]+":"+config.Port)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ func ExampleToDs(zone string) {
|
|||
}
|
||||
m.SetQuestion(Fqdn(zone), TypeDNSKEY)
|
||||
m.SetEdns0(4096, true)
|
||||
r, err := c.Exchange(m, config.Servers[0]+":"+config.Port)
|
||||
r, _, err := c.Exchange(m, config.Servers[0]+":"+config.Port)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ func HelloServer(w ResponseWriter, req *Msg) {
|
|||
|
||||
m.Extra = make([]RR, 1)
|
||||
m.Extra[0] = &RR_TXT{Hdr: RR_Header{Name: m.Question[0].Name, Rrtype: TypeTXT, Class: ClassINET, Ttl: 0}, Txt: []string{"Hello world"}}
|
||||
w.Write(m)
|
||||
w.WriteMsg(m)
|
||||
}
|
||||
|
||||
func AnotherHelloServer(w ResponseWriter, req *Msg) {
|
||||
|
@ -20,7 +20,7 @@ func AnotherHelloServer(w ResponseWriter, req *Msg) {
|
|||
|
||||
m.Extra = make([]RR, 1)
|
||||
m.Extra[0] = &RR_TXT{Hdr: RR_Header{Name: m.Question[0].Name, Rrtype: TypeTXT, Class: ClassINET, Ttl: 0}, Txt: []string{"Hello example"}}
|
||||
w.Write(m)
|
||||
w.WriteMsg(m)
|
||||
}
|
||||
|
||||
func TestServing(t *testing.T) {
|
||||
|
@ -38,14 +38,14 @@ func TestServing(t *testing.T) {
|
|||
m := new(Msg)
|
||||
|
||||
m.SetQuestion("miek.nl.", TypeTXT)
|
||||
r, _ := c.Exchange(m, "127.0.0.1:8053")
|
||||
r, _ , _ := c.Exchange(m, "127.0.0.1:8053")
|
||||
txt := r.Extra[0].(*RR_TXT).Txt[0]
|
||||
if txt != "Hello world" {
|
||||
t.Log("Unexpected result for miek.nl", txt, "!= Hello world")
|
||||
t.Fail()
|
||||
}
|
||||
m.SetQuestion("example.com.", TypeTXT)
|
||||
r, _ = c.Exchange(m, "127.0.0.1:8053")
|
||||
r, _, _ = c.Exchange(m, "127.0.0.1:8053")
|
||||
txt = r.Extra[0].(*RR_TXT).Txt[0]
|
||||
if txt != "Hello example" {
|
||||
t.Log("Unexpected result for example.com", txt, "!= Hello example")
|
||||
|
|
Loading…
Reference in New Issue