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 <miek@miek.nl>
This commit is contained in:
parent
84af068d46
commit
af1ebf55eb
|
@ -257,16 +257,14 @@ func TestClientSyncBadID(t *testing.T) {
|
||||||
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 wrapper, 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(err) {
|
if _, _, err := c.Exchange(m, addrstr); err == nil || !isNetworkTimeout(err) {
|
||||||
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) {
|
||||||
|
@ -290,14 +288,6 @@ func TestClientSyncBadThenGoodID(t *testing.T) {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue