Skip to content

Commit af1ebf5

Browse files
authored
Id check tests: stop using Exchange (#1343)
Using Exchange doesn't add anything, as it just wraps client.Exchange with a default client. Remove them and speed up the tests, goes from 3s to 1s (for the entire test suite). Signed-off-by: Miek Gieben <[email protected]>
1 parent 84af068 commit af1ebf5

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

client_test.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,14 @@ func TestClientSyncBadID(t *testing.T) {
257257
m := new(Msg)
258258
m.SetQuestion("miek.nl.", TypeSOA)
259259

260+
// Test with client.Exchange, the plain Exchange function is just a wrapper, so
261+
// we don't need to test that separately.
260262
c := &Client{
261-
Timeout: 50 * time.Millisecond,
263+
Timeout: 10 * time.Millisecond,
262264
}
263265
if _, _, err := c.Exchange(m, addrstr); err == nil || !isNetworkTimeout(err) {
264266
t.Errorf("query did not time out")
265267
}
266-
// And now with plain Exchange().
267-
if _, err = Exchange(m, addrstr); err == nil || !isNetworkTimeout(err) {
268-
t.Errorf("query did not time out")
269-
}
270268
}
271269

272270
func TestClientSyncBadThenGoodID(t *testing.T) {
@@ -290,14 +288,6 @@ func TestClientSyncBadThenGoodID(t *testing.T) {
290288
if r.Id != m.Id {
291289
t.Errorf("failed to get response with expected Id")
292290
}
293-
// And now with plain Exchange().
294-
r, err = Exchange(m, addrstr)
295-
if err != nil {
296-
t.Errorf("failed to exchange: %v", err)
297-
}
298-
if r.Id != m.Id {
299-
t.Errorf("failed to get response with expected Id")
300-
}
301291
}
302292

303293
func TestClientSyncTCPBadID(t *testing.T) {

0 commit comments

Comments
 (0)