"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "client_test.go" between
dns-1.1.46.tar.gz and dns-1.1.47.tar.gz

About: GO DNS implements a DNS library in Go.

client_test.go  (dns-1.1.46):client_test.go  (dns-1.1.47)
skipping to change at line 260 skipping to change at line 260
s, addrstr, _, err := RunLocalUDPServer(":0") s, addrstr, _, err := RunLocalUDPServer(":0")
if err != nil { if err != nil {
t.Fatalf("unable to run test server: %v", err) t.Fatalf("unable to run test server: %v", err)
} }
defer s.Shutdown() defer s.Shutdown()
m := new(Msg) m := new(Msg)
m.SetQuestion("miek.nl.", TypeSOA) m.SetQuestion("miek.nl.", TypeSOA)
// Test with client.Exchange, the plain Exchange function is just a wrapp
er, so
// we don't need to test that separately.
c := &Client{ c := &Client{
Timeout: 50 * time.Millisecond, Timeout: 10 * time.Millisecond,
} }
if _, _, err := c.Exchange(m, addrstr); err == nil || !isNetworkTimeout(e rr) { if _, _, err := c.Exchange(m, addrstr); err == nil || !isNetworkTimeout(e rr) {
t.Errorf("query did not time out") t.Errorf("query did not time out")
} }
// And now with plain Exchange().
if _, err = Exchange(m, addrstr); err == nil || !isNetworkTimeout(err) {
t.Errorf("query did not time out")
}
} }
func TestClientSyncBadThenGoodID(t *testing.T) { func TestClientSyncBadThenGoodID(t *testing.T) {
HandleFunc("miek.nl.", HelloServerBadThenGoodID) HandleFunc("miek.nl.", HelloServerBadThenGoodID)
defer HandleRemove("miek.nl.") defer HandleRemove("miek.nl.")
s, addrstr, _, err := RunLocalUDPServer(":0") s, addrstr, _, err := RunLocalUDPServer(":0")
if err != nil { if err != nil {
t.Fatalf("unable to run test server: %v", err) t.Fatalf("unable to run test server: %v", err)
} }
skipping to change at line 293 skipping to change at line 291
m.SetQuestion("miek.nl.", TypeSOA) m.SetQuestion("miek.nl.", TypeSOA)
c := new(Client) c := new(Client)
r, _, err := c.Exchange(m, addrstr) r, _, err := c.Exchange(m, addrstr)
if err != nil { if err != nil {
t.Errorf("failed to exchange: %v", err) t.Errorf("failed to exchange: %v", err)
} }
if r.Id != m.Id { if r.Id != m.Id {
t.Errorf("failed to get response with expected Id") t.Errorf("failed to get response with expected Id")
} }
// And now with plain Exchange().
r, err = Exchange(m, addrstr)
if err != nil {
t.Errorf("failed to exchange: %v", err)
}
if r.Id != m.Id {
t.Errorf("failed to get response with expected Id")
}
} }
func TestClientSyncTCPBadID(t *testing.T) { func TestClientSyncTCPBadID(t *testing.T) {
HandleFunc("miek.nl.", HelloServerBadID) HandleFunc("miek.nl.", HelloServerBadID)
defer HandleRemove("miek.nl.") defer HandleRemove("miek.nl.")
s, addrstr, _, err := RunLocalTCPServer(":0") s, addrstr, _, err := RunLocalTCPServer(":0")
if err != nil { if err != nil {
t.Fatalf("unable to run test server: %v", err) t.Fatalf("unable to run test server: %v", err)
} }
 End of changes. 4 change blocks. 
13 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)