|
1 | | -/* eslint-disable @typescript-eslint/no-empty-function */ |
2 | 1 | import { expect } from 'chai'; |
| 2 | +import { once } from 'events'; |
3 | 3 |
|
4 | 4 | import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; |
5 | 5 | import { type Collection, type FindCursor, type MongoClient } from '../../mongodb'; |
@@ -458,78 +458,6 @@ describe('MongoClient.close() Integration', () => { |
458 | 458 | }); |
459 | 459 | }); |
460 | 460 |
|
461 | | - describe('ClientSession (Implicit)', () => { |
462 | | - let idleSessionsBeforeClose; |
463 | | - let idleSessionsAfterClose; |
464 | | - let client; |
465 | | - let utilClient; |
466 | | - let session; |
467 | | - |
468 | | - const metadata: MongoDBMetadataUI = { |
469 | | - requires: { |
470 | | - topology: ['replicaset', 'sharded'], |
471 | | - mongodb: '>=4.2' |
472 | | - } |
473 | | - }; |
474 | | - |
475 | | - beforeEach(async function () { |
476 | | - client = this.configuration.newClient(); |
477 | | - utilClient = this.configuration.newClient(); |
478 | | - await client.connect(); |
479 | | - await client |
480 | | - .db('db') |
481 | | - .collection('collection') |
482 | | - .drop() |
483 | | - .catch(() => null); |
484 | | - const collection = await client.db('db').createCollection('collection'); |
485 | | - session = client.startSession({ explicit: false }); |
486 | | - session.startTransaction(); |
487 | | - await collection.insertOne({ x: 1 }, { session }); |
488 | | - |
489 | | - const opBefore = await utilClient.db().admin().command({ currentOp: 1 }); |
490 | | - idleSessionsBeforeClose = opBefore.inprog.filter(s => s.type === 'idleSession'); |
491 | | - |
492 | | - await client.close(); |
493 | | - |
494 | | - const opAfter = await utilClient.db().admin().command({ currentOp: 1 }); |
495 | | - idleSessionsAfterClose = opAfter.inprog.filter(s => s.type === 'idleSession'); |
496 | | - |
497 | | - await utilClient.close(); |
498 | | - }); |
499 | | - |
500 | | - afterEach(async function () { |
501 | | - await utilClient?.close(); |
502 | | - await session?.endSession(); |
503 | | - await client?.close(); |
504 | | - }); |
505 | | - |
506 | | - describe('Server resource: LSID/ServerSession', () => { |
507 | | - describe('after a clientSession is implicitly created and used', () => { |
508 | | - it( |
509 | | - 'the server-side ServerSession is cleaned up by client.close()', |
510 | | - metadata, |
511 | | - async function () { |
512 | | - expect(idleSessionsBeforeClose).to.not.be.empty; |
513 | | - expect(idleSessionsAfterClose).to.be.empty; |
514 | | - } |
515 | | - ); |
516 | | - }); |
517 | | - }); |
518 | | - |
519 | | - describe('Server resource: Transactions', () => { |
520 | | - describe('after a clientSession is implicitly created and used', () => { |
521 | | - it( |
522 | | - 'the server-side transaction is cleaned up by client.close()', |
523 | | - metadata, |
524 | | - async function () { |
525 | | - expect(idleSessionsBeforeClose[0].transaction.txnNumber).to.not.null; |
526 | | - expect(idleSessionsAfterClose).to.be.empty; |
527 | | - } |
528 | | - ); |
529 | | - }); |
530 | | - }); |
531 | | - }); |
532 | | - |
533 | 461 | describe('ClientSession (Explicit)', () => { |
534 | 462 | let idleSessionsBeforeClose; |
535 | 463 | let idleSessionsAfterClose; |
|
0 commit comments