@@ -471,6 +471,7 @@ func TestPool_checkOut(t *testing.T) {
471
471
472
472
dialErr := errors .New ("create new connection error" )
473
473
p := newPool (poolConfig {
474
+ Address : "testaddr" ,
474
475
ConnectTimeout : defaultConnectionTimeout ,
475
476
}, WithDialer (func (Dialer ) Dialer {
476
477
return DialerFunc (func (context.Context , string , string ) (net.Conn , error ) {
@@ -481,7 +482,7 @@ func TestPool_checkOut(t *testing.T) {
481
482
require .NoError (t , err )
482
483
483
484
_ , err = p .checkOut (context .Background ())
484
- var want error = ConnectionError {Wrapped : dialErr , init : true }
485
+ var want error = ConnectionError {Wrapped : dialErr , init : true , message : "failed to connect to testaddr:27017" }
485
486
assert .Equalf (t , want , err , "should return error from calling checkOut()" )
486
487
// If a connection initialization error occurs during checkOut, removing and closing the
487
488
// failed connection both happen asynchronously with the checkOut. Wait for up to 2s for
@@ -1278,7 +1279,7 @@ func TestBackgroundRead(t *testing.T) {
1278
1279
defer cancel ()
1279
1280
_ , err = conn .readWireMessage (ctx )
1280
1281
regex := regexp .MustCompile (
1281
- `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1282
+ `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1282
1283
)
1283
1284
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1284
1285
assert .Nil (t , conn .awaitRemainingBytes , "conn.awaitRemainingBytes should be nil" )
@@ -1318,7 +1319,7 @@ func TestBackgroundRead(t *testing.T) {
1318
1319
defer cancel ()
1319
1320
_ , err = conn .readWireMessage (ctx )
1320
1321
regex := regexp .MustCompile (
1321
- `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1322
+ `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1322
1323
)
1323
1324
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1324
1325
err = p .checkIn (conn )
@@ -1365,7 +1366,7 @@ func TestBackgroundRead(t *testing.T) {
1365
1366
defer cancel ()
1366
1367
_ , err = conn .readWireMessage (ctx )
1367
1368
regex := regexp .MustCompile (
1368
- `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1369
+ `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1369
1370
)
1370
1371
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1371
1372
err = p .checkIn (conn )
@@ -1417,7 +1418,7 @@ func TestBackgroundRead(t *testing.T) {
1417
1418
defer cancel ()
1418
1419
_ , err = conn .readWireMessage (ctx )
1419
1420
regex := regexp .MustCompile (
1420
- `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1421
+ `^connection\(.*\[-\d+\]\) incomplete read of message header: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1421
1422
)
1422
1423
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1423
1424
err = p .checkIn (conn )
@@ -1471,7 +1472,7 @@ func TestBackgroundRead(t *testing.T) {
1471
1472
defer cancel ()
1472
1473
_ , err = conn .readWireMessage (ctx )
1473
1474
regex := regexp .MustCompile (
1474
- `^connection\(.*\[-\d+\]\) incomplete read of full message: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1475
+ `^connection\(.*\[-\d+\]\) incomplete read of full message: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1475
1476
)
1476
1477
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1477
1478
err = p .checkIn (conn )
@@ -1521,7 +1522,7 @@ func TestBackgroundRead(t *testing.T) {
1521
1522
defer cancel ()
1522
1523
_ , err = conn .readWireMessage (ctx )
1523
1524
regex := regexp .MustCompile (
1524
- `^connection\(.*\[-\d+\]\) incomplete read of full message: context deadline exceeded: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1525
+ `^connection\(.*\[-\d+\]\) incomplete read of full message: context deadline exceeded: client timed out waiting for server response: read tcp 127.0.0.1:.*->127.0.0.1:.*: i\/o timeout$` ,
1525
1526
)
1526
1527
assert .True (t , regex .MatchString (err .Error ()), "error %q does not match pattern %q" , err , regex )
1527
1528
err = p .checkIn (conn )
0 commit comments