Add specific test file for fixing issues

This commit is contained in:
Miek Gieben 2016-02-28 16:15:32 +00:00
parent d9472276a1
commit 2403d251d5
1 changed files with 31 additions and 0 deletions

31
issue_test.go Normal file
View File

@ -0,0 +1,31 @@
package dns
import "testing"
// Tests that solve that a specific issue has been solved.
func TestTCPRtt(t *testing.T) {
m := new(Msg)
m.RecursionDesired = true
m.SetQuestion("example.org.", TypeA)
c := &Client{}
in, rtt, err := c.Exchange(m, "8.8.4.4:53")
if err != nil {
t.Fatal(err)
}
if rtt == 0 {
t.Fatalf("expecting non zero rtt, got zero")
}
t.Logf("%s", in)
c.Net = "tcp"
in, rtt, err = c.Exchange(m, "8.8.4.4:53")
if err != nil {
t.Fatal(err)
}
if rtt == 0 {
t.Fatalf("expecting non zero rtt, got zero")
}
t.Logf("%s", in)
}