Skip to content

Commit f2f8dce

Browse files
failing test fixed
1 parent 729c269 commit f2f8dce

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,23 +461,23 @@ describe('MongoClient.close() Integration', () => {
461461

462462
const metadata: MongoDBMetadataUI = {
463463
requires: {
464-
topology: ['replicaset', 'sharded'],
465-
mongodb: '>=5.0' // currentOp requires 5.0 and above
464+
topology: ['replicaset', 'sharded']
466465
}
467466
};
468467

469468
beforeEach(async function () {
470469
client = this.configuration.newClient();
471470
utilClient = this.configuration.newClient();
472471
await client.connect();
472+
await client
473+
.db('db')
474+
.collection('collection')
475+
?.drop()
476+
.catch(() => null);
473477
const collection = await client.db('db').createCollection('collection');
474-
console.log('createCollection done');
475478
session = client.startSession({ explicit: false });
476-
console.log('startSession done');
477479
session.startTransaction();
478-
console.log('startTransaction done');
479480
await collection.insertOne({ x: 1 }, { session });
480-
console.log('insert done');
481481

482482
const opBefore = await utilClient.db().admin().command({ currentOp: 1 });
483483
idleSessionsBeforeClose = opBefore.inprog.filter(s => s.type === 'idleSession');
@@ -530,12 +530,21 @@ describe('MongoClient.close() Integration', () => {
530530
let utilClient;
531531
let session;
532532

533-
const metadata: MongoDBMetadataUI = { requires: { topology: ['replicaset', 'sharded'] } };
533+
const metadata: MongoDBMetadataUI = {
534+
requires: {
535+
topology: ['replicaset', 'sharded']
536+
}
537+
};
534538

535539
beforeEach(async function () {
536540
client = this.configuration.newClient();
537541
utilClient = this.configuration.newClient();
538542
await client.connect();
543+
await client
544+
.db('db')
545+
.collection('collection')
546+
?.drop()
547+
.catch(() => null);
539548
const collection = await client.db('db').createCollection('collection');
540549
session = client.startSession();
541550
session.startTransaction();
@@ -697,7 +706,7 @@ describe('MongoClient.close() Integration', () => {
697706
client = this.configuration.newClient();
698707
utilClient = this.configuration.newClient();
699708
await client.connect();
700-
coll = await client.db('db').createCollection('coll', { capped: true, size: 1_000_000 });
709+
coll = await client.db('db').collection('coll', { capped: true, size: 1_000_000 });
701710
});
702711

703712
afterEach(async function () {

0 commit comments

Comments
 (0)