@@ -473,33 +473,41 @@ describe('class AbstractCursor', function () {
473473 } ) ;
474474
475475 describe ( 'when the cursor refreshes the timeout for killCursors' , function ( ) {
476- it ( 'the provided timeoutContext is not modified' , async function ( ) {
477- await client . db ( 'admin' ) . command ( {
478- configureFailPoint : 'failCommand' ,
479- mode : { times : 1 } ,
480- data : {
481- failCommands : [ 'getMore' ] ,
482- blockConnection : true ,
483- blockTimeMS : 5000
476+ it (
477+ 'the provided timeoutContext is not modified' ,
478+ {
479+ requires : {
480+ mongodb : '>=4.4'
484481 }
485- } as FailPoint ) ;
486-
487- const cursor = collection . find (
488- { } ,
489- {
490- timeoutContext : context ,
491- timeoutMS : 1000 ,
492- timeoutMode : CursorTimeoutMode . LIFETIME ,
493- batchSize : 1
494- }
495- ) ;
496-
497- const error = await cursor . toArray ( ) . catch ( e => e ) ;
498-
499- expect ( error ) . to . be . instanceof ( MongoOperationTimeoutError ) ;
500- // @ts -expect-error We know we have a CSOT timeout context but TS does not.
501- expect ( context . timeoutContext . remainingTimeMS ) . to . be . lessThan ( 0 ) ;
502- } ) ;
482+ } ,
483+ async function ( ) {
484+ await client . db ( 'admin' ) . command ( {
485+ configureFailPoint : 'failCommand' ,
486+ mode : { times : 1 } ,
487+ data : {
488+ failCommands : [ 'getMore' ] ,
489+ blockConnection : true ,
490+ blockTimeMS : 5000
491+ }
492+ } as FailPoint ) ;
493+
494+ const cursor = collection . find (
495+ { } ,
496+ {
497+ timeoutContext : context ,
498+ timeoutMS : 1000 ,
499+ timeoutMode : CursorTimeoutMode . LIFETIME ,
500+ batchSize : 1
501+ }
502+ ) ;
503+
504+ const error = await cursor . toArray ( ) . catch ( e => e ) ;
505+
506+ expect ( error ) . to . be . instanceof ( MongoOperationTimeoutError ) ;
507+ // @ts -expect-error We know we have a CSOT timeout context but TS does not.
508+ expect ( context . timeoutContext . remainingTimeMS ) . to . be . lessThan ( 0 ) ;
509+ }
510+ ) ;
503511 } ) ;
504512 } ) ;
505513} ) ;
0 commit comments