Skip to content

test(NODE-5823): CSOT unified runner changes #3966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/connection_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,9 @@ export const OPTIONS = {
target: 'tls',
type: 'boolean'
},
timeoutMS: {
type: 'uint'
},
tls: {
type: 'boolean'
},
Expand Down
2 changes: 2 additions & 0 deletions src/mongo_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export type SupportedNodeConnectionOptions = SupportedTLSConnectionOptions &
export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeConnectionOptions {
/** Specifies the name of the replica set, if the mongod is a member of a replica set. */
replicaSet?: string;
/** @internal This option is in development and currently has no behaviour. */
timeoutMS?: number;
/** Enables or disables TLS/SSL for the connection. */
tls?: boolean;
/** A boolean to enable or disables TLS/SSL for the connection. (The ssl option is equivalent to the tls option.) */
Expand Down
44 changes: 42 additions & 2 deletions test/tools/unified-spec-runner/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,30 @@ operations.set('dropCollection', async ({ entities, operation }) => {
}
});

operations.set('drop', async ({ entities, operation }) => {
const bucket = entities.getEntity('bucket', operation.object);
return bucket.drop();
});

operations.set('dropIndexes', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
return collection.dropIndexes();
});

operations.set('endSession', async ({ entities, operation }) => {
const session = entities.getEntity('session', operation.object);
return session.endSession();
});

operations.set('find', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
let queryable;
if (operation.object === 'bucket') {
queryable = entities.getEntity('bucket', operation.object);
} else {
queryable = entities.getEntity('collection', operation.object);
}
const { filter, ...opts } = operation.arguments!;
return collection.find(filter, opts).toArray();
return queryable.find(filter, opts).toArray();
});

operations.set('findOne', async ({ entities, operation }) => {
Expand Down Expand Up @@ -372,16 +387,35 @@ operations.set('listCollections', async ({ entities, operation }) => {
return db.listCollections(filter, opts).toArray();
});

operations.set('listCollectionNames', async ({ entities, operation }) => {
const db = entities.getEntity('db', operation.object);
const { filter, ...opts } = operation.arguments!;
const collections = await db.listCollections(filter, opts).toArray();
return collections.map(collection => collection.name);
});

operations.set('listDatabases', async ({ entities, operation }) => {
const client = entities.getEntity('client', operation.object);
return client.db().admin().listDatabases(operation.arguments!);
});

operations.set('listDatabaseNames', async ({ entities, operation }) => {
const client = entities.getEntity('client', operation.object);
const result = await client.db().admin().listDatabases(operation.arguments!);
return result.databases.map(database => database.name);
});

operations.set('listIndexes', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
return collection.listIndexes(operation.arguments!).toArray();
});

operations.set('listIndexNames', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
const indexes = await collection.listIndexes(operation.arguments!).toArray();
return indexes.map(index => index.name);
});

operations.set('loop', async ({ entities, operation, client, testConfig }) => {
const controller = new AbortController();
// We always want the process to exit on SIGINT last, so all other
Expand Down Expand Up @@ -680,6 +714,12 @@ operations.set('withTransaction', async ({ entities, operation, client, testConf
}, options);
});

operations.set('count', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
const { filter, ...opts } = operation.arguments!;
return collection.count(filter, opts);
});

operations.set('countDocuments', async ({ entities, operation }) => {
const collection = entities.getEntity('collection', operation.object);
const { filter, ...opts } = operation.arguments!;
Expand Down