Skip to content

Commit 80b87e0

Browse files
txn test fix
1 parent 24dcee8 commit 80b87e0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/integration/node-specific/client_close.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,9 @@ describe('MongoClient.close() Integration', () => {
462462
utilClient = this.configuration.newClient();
463463
await client.connect();
464464
session = client.startSession({ explicit: false });
465+
const collection = client.db('db').collection('collection');
465466
session.startTransaction();
466-
await client.db('db').collection('collection').insertOne({ x: 1 }, { session });
467+
await collection.insertOne({ x: 1 }, { session });
467468

468469
const opBefore = await utilClient.db().admin().command({ currentOp: 1 });
469470
idleSessionsBeforeClose = opBefore.inprog.filter(s => s.type === 'idleSession');
@@ -523,8 +524,9 @@ describe('MongoClient.close() Integration', () => {
523524
utilClient = this.configuration.newClient();
524525
await client.connect();
525526
session = client.startSession();
527+
const collection = client.db('db').collection('collection');
526528
session.startTransaction();
527-
await client.db('db').collection('collection').insertOne({ x: 1 }, { session });
529+
await collection.insertOne({ x: 1 }, { session });
528530

529531
const opBefore = await utilClient.db().admin().command({ currentOp: 1 });
530532
idleSessionsBeforeClose = opBefore.inprog.filter(s => s.type === 'idleSession');
@@ -691,14 +693,14 @@ describe('MongoClient.close() Integration', () => {
691693
await cursor?.close();
692694
});
693695

694-
it.skip('all active server-side cursors are closed by client.close()', async function () {
696+
it('all active server-side cursors are closed by client.close()', async function () {
695697
const getCursors = async () => {
696698
const res = await utilClient
697699
.db()
698700
.admin()
699701
.command({
700702
aggregate: 1,
701-
cursor: { batchSize: 10 },
703+
cursor: {},
702704
pipeline: [{ $currentOp: { idleCursors: true } }]
703705
});
704706
return res.cursor.firstBatch.filter(

0 commit comments

Comments
 (0)