@@ -1360,51 +1360,61 @@ describe('CSOT driver tests', metadata, () => {
13601360 } ) ;
13611361
13621362 // TODO(NODE-7118): Find a way to reimplement this test for latest server.
1363- describe . skip ( 'Connection after timeout' , { requires : { mongodb : '>=4.4' } } , function ( ) {
1364- let client : MongoClient ;
1363+ describe (
1364+ 'Connection after timeout' ,
1365+ {
1366+ requires : {
1367+ // 4.4 for use of failCommands
1368+ // < 8.3 because of https://jira.mongodb.org/browse/SERVER-101116
1369+ mongodb : '>=4.4 <=8.2'
1370+ }
1371+ } ,
1372+ function ( ) {
1373+ let client : MongoClient ;
13651374
1366- beforeEach ( async function ( ) {
1367- client = this . configuration . newClient ( { timeoutMS : 500 } ) ;
1375+ beforeEach ( async function ( ) {
1376+ client = this . configuration . newClient ( { timeoutMS : 500 } ) ;
13681377
1369- const failpoint : FailPoint = {
1370- configureFailPoint : 'failCommand' ,
1371- mode : {
1372- times : 1
1373- } ,
1374- data : {
1375- failCommands : [ 'insert' ] ,
1376- blockConnection : true ,
1377- blockTimeMS : 700
1378- }
1379- } ;
1378+ const failpoint : FailPoint = {
1379+ configureFailPoint : 'failCommand' ,
1380+ mode : {
1381+ times : 1
1382+ } ,
1383+ data : {
1384+ failCommands : [ 'insert' ] ,
1385+ blockConnection : true ,
1386+ blockTimeMS : 700
1387+ }
1388+ } ;
13801389
1381- await client . db ( 'admin' ) . command ( failpoint ) ;
1382- } ) ;
1390+ await client . db ( 'admin' ) . command ( failpoint ) ;
1391+ } ) ;
13831392
1384- afterEach ( async function ( ) {
1385- await client . close ( ) ;
1386- } ) ;
1393+ afterEach ( async function ( ) {
1394+ await client . close ( ) ;
1395+ } ) ;
13871396
1388- it ( 'closes so pending messages are not read by another operation' , async function ( ) {
1389- const cmap = [ ] ;
1390- client . on ( 'connectionCheckedOut' , ev => cmap . push ( ev ) ) ;
1391- client . on ( 'connectionClosed' , ev => cmap . push ( ev ) ) ;
1392-
1393- const error = await client
1394- . db ( 'socket' )
1395- . collection ( 'closes' )
1396- . insertOne ( { } )
1397- . catch ( error => error ) ;
1398-
1399- // Note: In the case where the timeout comes from the server, the driver does not
1400- // need to close the connection as no more potential messages are expected.
1401- expect ( error ) . to . be . instanceOf ( MongoOperationTimeoutError ) ;
1402- expect ( cmap ) . to . have . lengthOf ( 2 ) ;
1403-
1404- const [ checkedOut , closed ] = cmap ;
1405- expect ( checkedOut ) . to . have . property ( 'name' , 'connectionCheckedOut' ) ;
1406- expect ( closed ) . to . have . property ( 'name' , 'connectionClosed' ) ;
1407- expect ( checkedOut ) . to . have . property ( 'connectionId' , closed . connectionId ) ;
1408- } ) ;
1409- } ) ;
1397+ it ( 'closes so pending messages are not read by another operation' , async function ( ) {
1398+ const cmap = [ ] ;
1399+ client . on ( 'connectionCheckedOut' , ev => cmap . push ( ev ) ) ;
1400+ client . on ( 'connectionClosed' , ev => cmap . push ( ev ) ) ;
1401+
1402+ const error = await client
1403+ . db ( 'socket' )
1404+ . collection ( 'closes' )
1405+ . insertOne ( { } )
1406+ . catch ( error => error ) ;
1407+
1408+ // Note: In the case where the timeout comes from the server, the driver does not
1409+ // need to close the connection as no more potential messages are expected.
1410+ expect ( error ) . to . be . instanceOf ( MongoOperationTimeoutError ) ;
1411+ expect ( cmap ) . to . have . lengthOf ( 2 ) ;
1412+
1413+ const [ checkedOut , closed ] = cmap ;
1414+ expect ( checkedOut ) . to . have . property ( 'name' , 'connectionCheckedOut' ) ;
1415+ expect ( closed ) . to . have . property ( 'name' , 'connectionClosed' ) ;
1416+ expect ( checkedOut ) . to . have . property ( 'connectionId' , closed . connectionId ) ;
1417+ } ) ;
1418+ }
1419+ ) ;
14101420} ) ;
0 commit comments