@@ -114,6 +114,8 @@ func createClientOptions(t testing.TB, opts bson.Raw) *options.ClientOptions {
114
114
case "socketTimeoutMS" :
115
115
st := convertValueToMilliseconds (t , opt )
116
116
clientOpts .SetSocketTimeout (st )
117
+ case "timeoutMS" :
118
+ clientOpts .SetTimeout (time .Duration (opt .Int32 ()) * time .Millisecond )
117
119
case "minPoolSize" :
118
120
clientOpts .SetMinPoolSize (uint64 (opt .AsInt64 ()))
119
121
case "maxPoolSize" :
@@ -470,8 +472,9 @@ func errorFromResult(t testing.TB, result interface{}) *operationError {
470
472
if err != nil {
471
473
return nil
472
474
}
473
- if expected .ErrorCodeName == nil && expected .ErrorContains == nil && len (expected .ErrorLabelsOmit ) == 0 &&
474
- len (expected .ErrorLabelsContain ) == 0 {
475
+ if expected .ErrorCodeName == nil && expected .ErrorContains == nil &&
476
+ len (expected .ErrorLabelsOmit ) == 0 && len (expected .ErrorLabelsContain ) == 0 &&
477
+ expected .IsTimeoutError == nil {
475
478
return nil
476
479
}
477
480
@@ -563,6 +566,13 @@ func verifyError(expected *operationError, actual error) error {
563
566
return fmt .Errorf ("expected error %w to not contain label %q" , actual , label )
564
567
}
565
568
}
569
+ if expected .IsTimeoutError != nil {
570
+ isTimeoutError := mongo .IsTimeout (actual )
571
+ if * expected .IsTimeoutError != isTimeoutError {
572
+ return fmt .Errorf ("expected error %w to be a timeout error: %v, is timeout error: %v" ,
573
+ actual , * expected .IsTimeoutError , isTimeoutError )
574
+ }
575
+ }
566
576
return nil
567
577
}
568
578
0 commit comments