Skip to content

Commit b69f7f3

Browse files
committed
test(NODE-5823): CSOT unified runner changes
1 parent 86e2659 commit b69f7f3

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

src/connection_string.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,9 @@ export const OPTIONS = {
10901090
target: 'tls',
10911091
type: 'boolean'
10921092
},
1093+
timeoutMS: {
1094+
type: 'uint'
1095+
},
10931096
tls: {
10941097
type: 'boolean'
10951098
},

src/mongo_client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export type SupportedNodeConnectionOptions = SupportedTLSConnectionOptions &
118118
export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeConnectionOptions {
119119
/** Specifies the name of the replica set, if the mongod is a member of a replica set. */
120120
replicaSet?: string;
121+
/** @experimental */
122+
timeoutMS?: number;
121123
/** Enables or disables TLS/SSL for the connection. */
122124
tls?: boolean;
123125
/** A boolean to enable or disables TLS/SSL for the connection. (The ssl option is equivalent to the tls option.) */

test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { loadSpecTests } from '../../spec';
44
import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner';
55

66
// TODO(NODE-5823): Implement unified runner operations and options support for CSOT
7-
describe.skip('CSOT spec tests', function () {
7+
describe('CSOT spec tests', function () {
88
runUnifiedSuite(loadSpecTests(join('client-side-operations-timeout')));
99
});

test/tools/unified-spec-runner/operations.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,16 @@ operations.set('dropCollection', async ({ entities, operation }) => {
295295
}
296296
});
297297

298+
operations.set('drop', async ({ entities, operation }) => {
299+
const bucket = entities.getEntity('bucket', operation.object);
300+
return bucket.drop();
301+
});
302+
303+
operations.set('dropIndexes', async ({ entities, operation }) => {
304+
const collection = entities.getEntity('collection', operation.object);
305+
return collection.dropIndexes();
306+
});
307+
298308
operations.set('endSession', async ({ entities, operation }) => {
299309
const session = entities.getEntity('session', operation.object);
300310
return session.endSession();
@@ -372,16 +382,35 @@ operations.set('listCollections', async ({ entities, operation }) => {
372382
return db.listCollections(filter, opts).toArray();
373383
});
374384

385+
operations.set('listCollectionNames', async ({ entities, operation }) => {
386+
const db = entities.getEntity('db', operation.object);
387+
const { filter, ...opts } = operation.arguments!;
388+
const collections = await db.listCollections(filter, opts).toArray();
389+
return collections.map(collection => collection.name);
390+
});
391+
375392
operations.set('listDatabases', async ({ entities, operation }) => {
376393
const client = entities.getEntity('client', operation.object);
377394
return client.db().admin().listDatabases(operation.arguments!);
378395
});
379396

397+
operations.set('listDatabaseNames', async ({ entities, operation }) => {
398+
const client = entities.getEntity('client', operation.object);
399+
const result = await client.db().admin().listDatabases(operation.arguments!);
400+
return result.databases.map(database => database.name);
401+
});
402+
380403
operations.set('listIndexes', async ({ entities, operation }) => {
381404
const collection = entities.getEntity('collection', operation.object);
382405
return collection.listIndexes(operation.arguments!).toArray();
383406
});
384407

408+
operations.set('listIndexNames', async ({ entities, operation }) => {
409+
const collection = entities.getEntity('collection', operation.object);
410+
const indexes = await collection.listIndexes(operation.arguments!).toArray();
411+
return indexes.map(index => index.name);
412+
});
413+
385414
operations.set('loop', async ({ entities, operation, client, testConfig }) => {
386415
const controller = new AbortController();
387416
// We always want the process to exit on SIGINT last, so all other
@@ -680,6 +709,12 @@ operations.set('withTransaction', async ({ entities, operation, client, testConf
680709
}, options);
681710
});
682711

712+
operations.set('count', async ({ entities, operation }) => {
713+
const collection = entities.getEntity('collection', operation.object);
714+
const { filter, ...opts } = operation.arguments!;
715+
return collection.count(filter, opts);
716+
});
717+
683718
operations.set('countDocuments', async ({ entities, operation }) => {
684719
const collection = entities.getEntity('collection', operation.object);
685720
const { filter, ...opts } = operation.arguments!;

0 commit comments

Comments
 (0)