From eadeb01ec689c72032a9c21e3e8486001a026945 Mon Sep 17 00:00:00 2001 From: Andy Mina Date: Tue, 13 Jul 2021 15:53:10 -0400 Subject: [PATCH 1/8] feat(NODE-3419): define MongoRuntimeError children (#2893) --- src/error.ts | 239 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 233 insertions(+), 6 deletions(-) diff --git a/src/error.ts b/src/error.ts index 7d96dc49acd..c5112d54a95 100644 --- a/src/error.ts +++ b/src/error.ts @@ -202,7 +202,6 @@ export class MongoRuntimeError extends MongoDriverError { * An error generated when a batch command is reexecuted after one of the commands in the batch * has failed * - * * @public * @category Error */ @@ -216,11 +215,60 @@ export class MongoBatchReExecutionError extends MongoRuntimeError { } } +/** + * An error generated when the user supplies an incorrect URI to the driver. + * + * @public + * @category Error + */ +export class MongoURIError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoURIError'; + } +} + +/** + * An error generated when the driver fails to compress data + * before sending it to the server. + * + * @public + * @category Error + */ +export class MongoCompressionError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoCompressionError'; + } +} + +/** + * An error generated when the driver fails to decompress + * data received from the server. + * + * @public + * @category Error + */ +export class MongoDecompressionError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoDecompressionError'; + } +} + /** * An error thrown when the user attempts to operate on a database or collection through a MongoClient * that has not yet successfully called the "connect" method * - * * @public * @category Error */ @@ -234,11 +282,61 @@ export class MongoNotConnectedError extends MongoRuntimeError { } } +/** + * An error generated when the user makes a mistake in the usage of transactions. + * (e.g. attempting to commit a transaction with a readPreference other than primary) + * + * @public + * @category Error + */ +export class MongoTransactionError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoTransactionError'; + } +} + +/** + * An error generated when the user attempts to operate + * on a session that has expired or has been closed. + * + * @public + * @category Error + */ +export class MongoExpiredSessionError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoExpiredSessionError'; + } +} + +/** + * A error generated when the user attempts to authenticate + * via Kerberos, but fails to connect to the Kerberos client. + * + * @public + * @category Error + */ +export class MongoKerberosError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoKerberosError'; + } +} + /** * An error thrown when the user attempts to operate on a cursor that is in a state which does not * support the attempted operation. * - * * @public * @category Error */ @@ -253,8 +351,39 @@ export class MongoCursorError extends MongoRuntimeError { } /** - * An error thrown when the user calls a function or method not supported on a tailable cursor + * An error generated when a stream operation fails to execute. * + * @public + * @category Error + */ +export class MongoStreamError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoStreamError'; + } +} + +/** + * An error generated when a ChangeStream operation fails to execute. + * + * @public + * @category Error + */ +export class MongoChangeStreamError extends MongoStreamError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoChangeStreamError'; + } +} + +/** + * An error thrown when the user calls a function or method not supported on a tailable cursor * * @public * @category Error @@ -269,11 +398,42 @@ export class MongoTailableCursorError extends MongoCursorError { } } +/** An error generated when a GridFSStream operation fails to execute. + * + * @public + * @category Error + */ +export class MongoGridFSStreamError extends MongoStreamError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoGridFSStreamError'; + } +} + +/** + * An error generated when a malformed or invalid chunk is + * encountered when reading from a GridFSStream. + * + * @public + * @category Error + */ +export class MongoGridFSChunkError extends MongoStreamError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoGridFSChunkError'; + } +} + /** * An error thrown when the user attempts to add options to a cursor that has already been * initialized * - * * @public * @category Error */ @@ -288,8 +448,41 @@ export class MongoCursorInUseError extends MongoCursorError { } /** - * An error thrown when an attempt is made to read from a cursor that has been exhausted + * An error generated when an attempt is made to access a resource + * which has already been or will be closed/destroyed. * + * @public + * @category Error + */ +export class MongoResourceClosedError extends MongoRuntimeError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoResourceClosedError'; + } +} + +/** + * An error generated when an attempt is made to operate + * on a closed/closing server. + * + * @public + * @category Error + */ +export class MongoServerClosedError extends MongoResourceClosedError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoServerClosedError'; + } +} + +/** + * An error thrown when an attempt is made to read from a cursor that has been exhausted * * @public * @category Error @@ -304,6 +497,40 @@ export class MongoCursorExhaustedError extends MongoCursorError { } } +/** + * An error generated when an attempt is made to operate + * on a closed/closing stream. + * + * @public + * @category Error + */ +export class MongoStreamClosedError extends MongoResourceClosedError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoStreamClosedError'; + } +} + +/** + * An error generated when an attempt is made to operate on a + * dropped, or otherwise unavailable, database. + * + * @public + * @category Error + */ +export class MongoTopologyClosedError extends MongoResourceClosedError { + constructor(message: string) { + super(message); + } + + get name(): string { + return 'MongoTopologyClosedError'; + } +} + /** @internal */ const kBeforeHandshake = Symbol('beforeHandshake'); export function isNetworkErrorBeforeHandshake(err: MongoNetworkError): boolean { From fa4352d297e70b83e48c1cb225eaab7cbe7404ab Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 14 Jul 2021 18:53:51 +0200 Subject: [PATCH 2/8] test: new test runner changes from lb support (#2901) * test: new test runner changes from lb support * test: refactoring unified runner * test: bring back unified event length check * test: run txn tests in manual lb tests * test: skip failing snapshot test and refactor matchers * test: remove lb manual test * test: skip other failed tests --- test/functional/sessions.test.js | 5 +- .../unified-spec-runner/entities.ts | 144 +++++++++++++++--- test/functional/unified-spec-runner/match.ts | 79 ++++++++-- .../unified-spec-runner/operations.ts | 71 +++++++-- test/functional/unified-spec-runner/runner.ts | 30 +++- test/functional/unified-spec-runner/schema.ts | 44 +++++- .../unified-spec-runner/unified-utils.ts | 15 +- test/tools/runner/config.js | 10 ++ test/tools/runner/index.js | 9 ++ 9 files changed, 344 insertions(+), 63 deletions(-) diff --git a/test/functional/sessions.test.js b/test/functional/sessions.test.js index 93b99be5a04..f0e0fb5cb75 100644 --- a/test/functional/sessions.test.js +++ b/test/functional/sessions.test.js @@ -217,7 +217,10 @@ describe('Sessions - functional', function () { 'Server returns an error on listCollections with snapshot', 'Server returns an error on listDatabases with snapshot', 'Server returns an error on listIndexes with snapshot', - 'Server returns an error on runCommand with snapshot' + 'Server returns an error on runCommand with snapshot', + 'Server returns an error on findOneAndUpdate with snapshot', + 'Server returns an error on deleteOne with snapshot', + 'Server returns an error on updateOne with snapshot' ] }; const testsToSkip = skipTestMap[sessionTests.description] || []; diff --git a/test/functional/unified-spec-runner/entities.ts b/test/functional/unified-spec-runner/entities.ts index eccf54ce79a..a1adff3e9f3 100644 --- a/test/functional/unified-spec-runner/entities.ts +++ b/test/functional/unified-spec-runner/entities.ts @@ -11,7 +11,20 @@ import { WriteConcern } from '../../../src/write_concern'; import { ReadPreference } from '../../../src/read_preference'; import { ClientSession } from '../../../src/sessions'; import { ChangeStream } from '../../../src/change_stream'; +import { FindCursor } from '../../../src/cursor/find_cursor'; import type { ClientEntity, EntityDescription } from './schema'; +import type { + ConnectionPoolCreatedEvent, + ConnectionPoolClosedEvent, + ConnectionCreatedEvent, + ConnectionReadyEvent, + ConnectionClosedEvent, + ConnectionCheckOutStartedEvent, + ConnectionCheckOutFailedEvent, + ConnectionCheckedOutEvent, + ConnectionCheckedInEvent, + ConnectionPoolClearedEvent +} from '../../../src/cmap/connection_pool_events'; import type { CommandFailedEvent, CommandStartedEvent, @@ -26,6 +39,17 @@ interface UnifiedChangeStream extends ChangeStream { } export type CommandEvent = CommandStartedEvent | CommandSucceededEvent | CommandFailedEvent; +export type CmapEvent = + | ConnectionPoolCreatedEvent + | ConnectionPoolClosedEvent + | ConnectionCreatedEvent + | ConnectionReadyEvent + | ConnectionClosedEvent + | ConnectionCheckOutStartedEvent + | ConnectionCheckOutFailedEvent + | ConnectionCheckedOutEvent + | ConnectionCheckedInEvent + | ConnectionPoolClearedEvent; function serverApiConfig() { if (process.env.MONGODB_API_VERSION) { @@ -38,52 +62,105 @@ function getClient(address) { return new MongoClient(`mongodb://${address}`, serverApi ? { serverApi } : {}); } +type PushFunction = (e: CommandEvent | CmapEvent) => void; + export class UnifiedMongoClient extends MongoClient { - events: CommandEvent[]; + commandEvents: CommandEvent[]; + cmapEvents: CmapEvent[]; failPoints: Document[]; ignoredEvents: string[]; - observedEvents: ('commandStarted' | 'commandSucceeded' | 'commandFailed')[]; + observedCommandEvents: ('commandStarted' | 'commandSucceeded' | 'commandFailed')[]; + observedCmapEvents: ( + | 'connectionPoolCreated' + | 'connectionPoolClosed' + | 'connectionPoolCleared' + | 'connectionCreated' + | 'connectionReady' + | 'connectionClosed' + | 'connectionCheckOutStarted' + | 'connectionCheckOutFailed' + | 'connectionCheckedOut' + | 'connectionCheckedIn' + )[]; - static EVENT_NAME_LOOKUP = { + static COMMAND_EVENT_NAME_LOOKUP = { commandStartedEvent: 'commandStarted', commandSucceededEvent: 'commandSucceeded', commandFailedEvent: 'commandFailed' } as const; + static CMAP_EVENT_NAME_LOOKUP = { + poolCreatedEvent: 'connectionPoolCreated', + poolClosedEvent: 'connectionPoolClosed', + poolClearedEvent: 'connectionPoolCleared', + connectionCreatedEvent: 'connectionCreated', + connectionReadyEvent: 'connectionReady', + connectionClosedEvent: 'connectionClosed', + connectionCheckOutStartedEvent: 'connectionCheckOutStarted', + connectionCheckOutFailedEvent: 'connectionCheckOutFailed', + connectionCheckedOutEvent: 'connectionCheckedOut', + connectionCheckedInEvent: 'connectionCheckedIn' + } as const; + constructor(url: string, description: ClientEntity) { super(url, { monitorCommands: true, ...description.uriOptions, serverApi: description.serverApi ? description.serverApi : serverApiConfig() }); - this.events = []; + this.commandEvents = []; + this.cmapEvents = []; this.failPoints = []; this.ignoredEvents = [ ...(description.ignoreCommandMonitoringEvents ?? []), 'configureFailPoint' ]; - // apm - this.observedEvents = (description.observeEvents ?? []).map( - e => UnifiedMongoClient.EVENT_NAME_LOOKUP[e] - ); - for (const eventName of this.observedEvents) { - this.on(eventName, this.pushEvent); + this.observedCommandEvents = (description.observeEvents ?? []) + .map(e => UnifiedMongoClient.COMMAND_EVENT_NAME_LOOKUP[e]) + .filter(e => !!e); + this.observedCmapEvents = (description.observeEvents ?? []) + .map(e => UnifiedMongoClient.CMAP_EVENT_NAME_LOOKUP[e]) + .filter(e => !!e); + for (const eventName of this.observedCommandEvents) { + this.on(eventName, this.pushCommandEvent); + } + for (const eventName of this.observedCmapEvents) { + this.on(eventName, this.pushCmapEvent); } } - // NOTE: pushEvent must be an arrow function - pushEvent: (e: CommandEvent) => void = e => { - if (!this.ignoredEvents.includes(e.commandName)) { - this.events.push(e); + isIgnored(e: CommandEvent | CmapEvent): boolean { + return this.ignoredEvents.includes(e.commandName); + } + + // NOTE: pushCommandEvent must be an arrow function + pushCommandEvent: (e: CommandEvent) => void = e => { + if (!this.isIgnored(e)) { + this.commandEvents.push(e); } }; - /** Disables command monitoring for the client and returns a list of the captured events. */ - stopCapturingEvents(): CommandEvent[] { - for (const eventName of this.observedEvents) { - this.off(eventName, this.pushEvent); + // NOTE: pushCmapEvent must be an arrow function + pushCmapEvent: (e: CmapEvent) => void = e => { + this.cmapEvents.push(e); + }; + + stopCapturingEvents(pushFn: PushFunction): void { + const observedEvents = this.observedCommandEvents.concat(this.observedCmapEvents); + for (const eventName of observedEvents) { + this.off(eventName, pushFn); } - return this.events; + } + + /** Disables command monitoring for the client and returns a list of the captured events. */ + stopCapturingCommandEvents(): CommandEvent[] { + this.stopCapturingEvents(this.pushCommandEvent); + return this.commandEvents; + } + + stopCapturingCmapEvents(): CmapEvent[] { + this.stopCapturingEvents(this.pushCmapEvent); + return this.cmapEvents; } } @@ -137,6 +214,7 @@ export type Entity = | Db | Collection | ClientSession + | FindCursor | UnifiedChangeStream | GridFSBucket | Document; // Results from operations @@ -147,9 +225,17 @@ export type EntityCtor = | typeof Collection | typeof ClientSession | typeof ChangeStream + | typeof FindCursor | typeof GridFSBucket; -export type EntityTypeId = 'client' | 'db' | 'collection' | 'session' | 'bucket' | 'stream'; +export type EntityTypeId = + | 'client' + | 'db' + | 'collection' + | 'session' + | 'bucket' + | 'cursor' + | 'stream'; const ENTITY_CTORS = new Map(); ENTITY_CTORS.set('client', UnifiedMongoClient); @@ -157,6 +243,7 @@ ENTITY_CTORS.set('db', Db); ENTITY_CTORS.set('collection', Collection); ENTITY_CTORS.set('session', ClientSession); ENTITY_CTORS.set('bucket', GridFSBucket); +ENTITY_CTORS.set('cursor', FindCursor); ENTITY_CTORS.set('stream', ChangeStream); export class EntitiesMap extends Map { @@ -172,6 +259,7 @@ export class EntitiesMap extends Map { mapOf(type: 'collection'): EntitiesMap; mapOf(type: 'session'): EntitiesMap; mapOf(type: 'bucket'): EntitiesMap; + mapOf(type: 'cursor'): EntitiesMap; mapOf(type: 'stream'): EntitiesMap; mapOf(type: EntityTypeId): EntitiesMap { const ctor = ENTITY_CTORS.get(type); @@ -186,6 +274,7 @@ export class EntitiesMap extends Map { getEntity(type: 'collection', key: string, assertExists?: boolean): Collection; getEntity(type: 'session', key: string, assertExists?: boolean): ClientSession; getEntity(type: 'bucket', key: string, assertExists?: boolean): GridFSBucket; + getEntity(type: 'cursor', key: string, assertExists?: boolean): FindCursor; getEntity(type: 'stream', key: string, assertExists?: boolean): UnifiedChangeStream; getEntity(type: EntityTypeId, key: string, assertExists = true): Entity { const entity = this.get(key); @@ -205,11 +294,17 @@ export class EntitiesMap extends Map { async cleanup(): Promise { await this.failPoints.disableFailPoints(); - for (const [, client] of this.mapOf('client')) { - await client.close(); + for (const [, cursor] of this.mapOf('cursor')) { + await cursor.close(); + } + for (const [, stream] of this.mapOf('stream')) { + await stream.close(); } for (const [, session] of this.mapOf('session')) { - await session.endSession(); + await session.endSession({ force: true }); + } + for (const [, client] of this.mapOf('client')) { + await client.close(); } this.clear(); } @@ -222,7 +317,8 @@ export class EntitiesMap extends Map { for (const entity of entities ?? []) { if ('client' in entity) { const useMultipleMongoses = - config.topologyType === 'Sharded' && entity.client.useMultipleMongoses; + (config.topologyType === 'LoadBalanced' || config.topologyType === 'Sharded') && + entity.client.useMultipleMongoses; const uri = config.url({ useMultipleMongoses }); const client = new UnifiedMongoClient(uri, entity.client); await client.connect(); diff --git a/test/functional/unified-spec-runner/match.ts b/test/functional/unified-spec-runner/match.ts index e9644094768..319955a180f 100644 --- a/test/functional/unified-spec-runner/match.ts +++ b/test/functional/unified-spec-runner/match.ts @@ -1,12 +1,25 @@ import { expect } from 'chai'; +import { inspect } from 'util'; import { Binary, Document, Long, ObjectId, MongoError } from '../../../src'; import { CommandFailedEvent, CommandStartedEvent, CommandSucceededEvent } from '../../../src/cmap/command_monitoring_events'; -import { CommandEvent, EntitiesMap } from './entities'; -import { ExpectedError, ExpectedEvent } from './schema'; +import { + ConnectionPoolCreatedEvent, + ConnectionPoolClosedEvent, + ConnectionCreatedEvent, + ConnectionReadyEvent, + ConnectionClosedEvent, + ConnectionCheckOutStartedEvent, + ConnectionCheckOutFailedEvent, + ConnectionCheckedOutEvent, + ConnectionCheckedInEvent, + ConnectionPoolClearedEvent +} from '../../../src/cmap/connection_pool_events'; +import { CommandEvent, CmapEvent, EntitiesMap } from './entities'; +import { ExpectedCmapEvent, ExpectedCommandEvent, ExpectedError } from './schema'; export interface ExistsOperator { $$exists: boolean; @@ -235,32 +248,70 @@ export function specialCheck( } } +// CMAP events where the payload does not matter. +const EMPTY_CMAP_EVENTS = { + poolCreatedEvent: ConnectionPoolCreatedEvent, + poolClosedEvent: ConnectionPoolClosedEvent, + connectionCreatedEvent: ConnectionCreatedEvent, + connectionReadyEvent: ConnectionReadyEvent, + connectionCheckOutStartedEvent: ConnectionCheckOutStartedEvent, + connectionCheckOutFailedEvent: ConnectionCheckOutFailedEvent, + connectionCheckedOutEvent: ConnectionCheckedOutEvent, + connectionCheckedInEvent: ConnectionCheckedInEvent +}; + +function validEmptyCmapEvent( + expected: ExpectedCommandEvent | ExpectedCmapEvent, + actual: CommandEvent | CmapEvent +) { + return Object.values(EMPTY_CMAP_EVENTS).some(value => { + return actual instanceof value; + }); +} + export function matchesEvents( - expected: ExpectedEvent[], - actual: CommandEvent[], + expected: (ExpectedCommandEvent & ExpectedCmapEvent)[], + actual: (CommandEvent & CmapEvent)[], entities: EntitiesMap ): void { - // TODO: NodeJS Driver has extra events - // expect(actual).to.have.lengthOf(expected.length); + if (actual.length !== expected.length) { + const actualNames = actual.map(a => a.constructor.name); + const expectedNames = expected.map(e => Object.keys(e)[0]); + expect.fail( + `Expected event count mismatch, expected ${inspect(expectedNames)} but got ${inspect( + actualNames + )}` + ); + } for (const [index, actualEvent] of actual.entries()) { const expectedEvent = expected[index]; - if (expectedEvent.commandStartedEvent && actualEvent instanceof CommandStartedEvent) { + if (expectedEvent.commandStartedEvent) { + expect(actualEvent).to.be.instanceOf(CommandStartedEvent); resultCheck(actualEvent, expectedEvent.commandStartedEvent, entities, [ `events[${index}].commandStartedEvent` ]); - } else if ( - expectedEvent.commandSucceededEvent && - actualEvent instanceof CommandSucceededEvent - ) { + } else if (expectedEvent.commandSucceededEvent) { + expect(actualEvent).to.be.instanceOf(CommandSucceededEvent); resultCheck(actualEvent, expectedEvent.commandSucceededEvent, entities, [ `events[${index}].commandSucceededEvent` ]); - } else if (expectedEvent.commandFailedEvent && actualEvent instanceof CommandFailedEvent) { + } else if (expectedEvent.commandFailedEvent) { + expect(actualEvent).to.be.instanceOf(CommandFailedEvent); expect(actualEvent.commandName).to.equal(expectedEvent.commandFailedEvent.commandName); - } else { - expect.fail(`Events must be one of the known types, got ${actualEvent}`); + } else if (expectedEvent.connectionClosedEvent) { + expect(actualEvent).to.be.instanceOf(ConnectionClosedEvent); + if (expectedEvent.connectionClosedEvent.hasServiceId) { + expect(actualEvent).property('serviceId').to.exist; + } + } else if (expectedEvent.poolClearedEvent) { + expect(actualEvent).to.be.instanceOf(ConnectionPoolClearedEvent); + if (expectedEvent.poolClearedEvent.hasServiceId) { + expect(actualEvent).property('serviceId').to.exist; + } + } else if (!validEmptyCmapEvent(expectedEvent, actualEvent)) { + expect.fail(`Events must be one of the known types, got ${inspect(actualEvent)}`); } } } diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index 26fcd8df830..40aa0f864ab 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -121,9 +121,9 @@ operations.set('assertDifferentLsidOnLastTwoCommands', async ({ entities, operat operations.set('assertSameLsidOnLastTwoCommands', async ({ entities, operation }) => { const client = entities.getEntity('client', operation.arguments.client); - expect(client.observedEvents.includes('commandStarted')).to.be.true; + expect(client.observedCommandEvents.includes('commandStarted')).to.be.true; - const startedEvents = client.events.filter( + const startedEvents = client.commandEvents.filter( ev => ev instanceof CommandStartedEvent ) as CommandStartedEvent[]; @@ -173,11 +173,34 @@ operations.set('assertSessionTransactionState', async ({ entities, operation }) expect(session.transaction.state).to.equal(driverTransactionStateName); }); +operations.set('assertNumberConnectionsCheckedOut', async ({ entities, operation }) => { + const client = entities.getEntity('client', operation.arguments.client); + const servers = Array.from(client.topology.s.servers.values()); + const checkedOutConnections = servers.reduce((count, server) => { + const pool = server.s.pool; + return count + pool.currentCheckedOutCount; + }, 0); + expect(checkedOutConnections).to.equal(operation.arguments.connections); +}); + operations.set('bulkWrite', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); return collection.bulkWrite(operation.arguments.requests); }); +// The entity exists for the name but can potentially have the wrong +// type (stream/cursor) which will also throw an exception even when +// telling getEntity() to ignore checking existence. +operations.set('close', async ({ entities, operation }) => { + try { + const cursor = entities.getEntity('cursor', operation.object); + await cursor.close(); + } catch (e) { + const changeStream = entities.getEntity('stream', operation.object); + await changeStream.close(); + } +}); + operations.set('commitTransaction', async ({ entities, operation }) => { const session = entities.getEntity('session', operation.object); return session.commitTransaction(); @@ -219,6 +242,17 @@ operations.set('createCollection', async ({ entities, operation }) => { }); }); +operations.set('createFindCursor', async ({ entities, operation }) => { + const collection = entities.getEntity('collection', operation.object); + const { filter, sort, batchSize, limit, let: vars } = operation.arguments; + const cursor = collection.find(filter, { sort, batchSize, limit, let: vars }); + // The spec dictates that we create the cursor and force the find command + // to execute, but don't move the cursor forward. hasNext() accomplishes + // this. + await cursor.hasNext(); + return cursor; +}); + operations.set('createIndex', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); const session = entities.getEntity('session', operation.arguments.session, false); @@ -294,12 +328,23 @@ operations.set('insertMany', async ({ entities, operation }) => { }); operations.set('iterateUntilDocumentOrError', async ({ entities, operation }) => { - const changeStream = entities.getEntity('stream', operation.object); - // Either change or error promise will finish - return Promise.race([ - changeStream.eventCollector.waitAndShiftEvent('change'), - changeStream.eventCollector.waitAndShiftEvent('error') - ]); + try { + const changeStream = entities.getEntity('stream', operation.object); + // Either change or error promise will finish + return Promise.race([ + changeStream.eventCollector.waitAndShiftEvent('change'), + changeStream.eventCollector.waitAndShiftEvent('error') + ]); + } catch (e) { + const findCursor = entities.getEntity('cursor', operation.object); + return await findCursor.next(); + } +}); + +operations.set('listCollections', async ({ entities, operation }) => { + const db = entities.getEntity('db', operation.object); + const { filter, ...opts } = operation.arguments; + return db.listCollections(filter, opts).toArray(); }); operations.set('listDatabases', async ({ entities, operation }) => { @@ -307,6 +352,11 @@ operations.set('listDatabases', async ({ entities, operation }) => { return client.db().admin().listDatabases(); }); +operations.set('listIndexes', async ({ entities, operation }) => { + const collection = entities.getEntity('collection', operation.object); + return collection.listIndexes(operation.arguments).toArray(); +}); + operations.set('replaceOne', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); return collection.replaceOne(operation.arguments.filter, operation.arguments.replacement, { @@ -441,12 +491,15 @@ export async function executeOperationAndCheck( if (operation.expectError) { expectErrorCheck(error, operation.expectError, entities); return; - } else { + } else if (!operation.ignoreResultAndError) { throw error; } } // We check the positive outcome here so the try-catch above doesn't catch our chai assertions + if (operation.ignoreResultAndError) { + return; + } if (operation.expectError) { expect.fail(`Operation ${operation.name} succeeded but was not supposed to`); diff --git a/test/functional/unified-spec-runner/runner.ts b/test/functional/unified-spec-runner/runner.ts index eb545670af6..6f55f49cd59 100644 --- a/test/functional/unified-spec-runner/runner.ts +++ b/test/functional/unified-spec-runner/runner.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { ReadPreference } from '../../../src/read_preference'; import * as uni from './schema'; import { zip, topologySatisfies, patchVersion } from './unified-utils'; -import { CommandEvent, EntitiesMap } from './entities'; +import { CmapEvent, CommandEvent, EntitiesMap } from './entities'; import { ns } from '../../../src/utils'; import { executeOperationAndCheck } from './operations'; import { matchesEvents } from './match'; @@ -41,7 +41,13 @@ export async function runUnifiedTest( ctx.skip(); } - const utilClient = ctx.configuration.newClient(); + let utilClient; + if (ctx.configuration.isLoadBalanced) { + // The util client can always point at the single mongos LB frontend. + utilClient = ctx.configuration.newClient(ctx.configuration.singleMongosLoadBalancerUri); + } else { + utilClient = ctx.configuration.newClient(); + } let entities; try { @@ -107,7 +113,8 @@ export async function runUnifiedTest( // To ease the implementation, test runners MAY execute distinct before every test. if ( ctx.topologyType === uni.TopologyType.sharded || - ctx.topologyType === uni.TopologyType.shardedReplicaset + ctx.topologyType === uni.TopologyType.shardedReplicaset || + ctx.topologyType === uni.TopologyType.loadBalanced ) { for (const [, collection] of entities.mapOf('collection')) { await utilClient.db(ns(collection.namespace).db).command({ @@ -121,18 +128,27 @@ export async function runUnifiedTest( await executeOperationAndCheck(operation, entities, utilClient); } - const clientEvents = new Map(); + const clientCommandEvents = new Map(); + const clientCmapEvents = new Map(); // If any event listeners were enabled on any client entities, // the test runner MUST now disable those event listeners. for (const [id, client] of entities.mapOf('client')) { - clientEvents.set(id, client.stopCapturingEvents()); + clientCommandEvents.set(id, client.stopCapturingCommandEvents()); + clientCmapEvents.set(id, client.stopCapturingCmapEvents()); } if (test.expectEvents) { for (const expectedEventList of test.expectEvents) { const clientId = expectedEventList.client; - const actualEvents = clientEvents.get(clientId); - + const eventType = expectedEventList.eventType; + let actualEvents; + // If no event type is provided it defaults to 'command', so just + // check for 'cmap' here for now. + if (eventType === 'cmap') { + actualEvents = clientCmapEvents.get(clientId); + } else { + actualEvents = clientCommandEvents.get(clientId); + } expect(actualEvents, `No client entity found with id ${clientId}`).to.exist; matchesEvents(expectedEventList.events, actualEvents, entities); } diff --git a/test/functional/unified-spec-runner/schema.ts b/test/functional/unified-spec-runner/schema.ts index 41cb00221ae..659f0b6c328 100644 --- a/test/functional/unified-spec-runner/schema.ts +++ b/test/functional/unified-spec-runner/schema.ts @@ -1,4 +1,4 @@ -import type { Document } from '../../../src/bson'; +import type { Document, ObjectId } from '../../../src/bson'; import type { ReadConcernLevel } from '../../../src/read_concern'; import type { ReadPreferenceMode } from '../../../src/read_preference'; import type { TagSet } from '../../../src/sdam/server_description'; @@ -27,7 +27,8 @@ export const TopologyType = Object.freeze({ single: 'single', replicaset: 'replicaset', sharded: 'sharded', - shardedReplicaset: 'sharded-replicaset' + shardedReplicaset: 'sharded-replicaset', + loadBalanced: 'load-balanced' } as const); export type TopologyId = typeof TopologyType[keyof typeof TopologyType]; export interface RunOnRequirement { @@ -36,16 +37,27 @@ export interface RunOnRequirement { topologies?: TopologyId[]; serverParameters?: Document; } -export type ObservableEventId = +export type ObservableCommandEventId = | 'commandStartedEvent' | 'commandSucceededEvent' | 'commandFailedEvent'; +export type ObservableCmapEventId = + | 'connectionPoolCreatedEvent' + | 'connectionPoolClosedEvent' + | 'connectionPoolClearedEvent' + | 'connectionCreatedEvent' + | 'connectionReadyEvent' + | 'connectionClosedEvent' + | 'connectionCheckOutStartedEvent' + | 'connectionCheckOutFailedEvent' + | 'connectionCheckedOutEvent' + | 'connectionCheckedInEvent'; export interface ClientEntity { id: string; uriOptions?: Document; useMultipleMongoses?: boolean; - observeEvents?: ObservableEventId[]; + observeEvents?: (ObservableCommandEventId | ObservableCmapEventId)[]; ignoreCommandMonitoringEvents?: string[]; serverApi?: ServerApi; } @@ -118,9 +130,10 @@ export interface Test { } export interface ExpectedEventsForClient { client: string; - events: ExpectedEvent[]; + eventType?: string; + events: (ExpectedCommandEvent | ExpectedCmapEvent)[]; } -export interface ExpectedEvent { +export interface ExpectedCommandEvent { commandStartedEvent?: { command?: Document; commandName?: string; @@ -134,6 +147,25 @@ export interface ExpectedEvent { commandName?: string; }; } +export interface ExpectedCmapEvent { + poolCreatedEvent?: Record; + poolReadyEvent?: Record; + poolClearedEvent?: { + serviceId?: ObjectId; + hasServiceId?: boolean; + }; + poolClosedEvent?: Record; + connectionCreatedEvent?: Record; + connectionReadyEvent?: Record; + connectionClosedEvent?: { + reason?: string; + hasServiceId?: boolean; + }; + connectionCheckOutStartedEvent?: Record; + connectionCheckOutFailedEvent?: Record; + connectionCheckedOutEvent?: Record; + connectionCheckedInEvent?: Record; +} export interface ExpectedError { isError?: true; isClientError?: boolean; diff --git a/test/functional/unified-spec-runner/unified-utils.ts b/test/functional/unified-spec-runner/unified-utils.ts index ea5b8dfe59a..9f9ad171db3 100644 --- a/test/functional/unified-spec-runner/unified-utils.ts +++ b/test/functional/unified-spec-runner/unified-utils.ts @@ -31,10 +31,14 @@ export async function topologySatisfies( Single: 'single', ReplicaSetNoPrimary: 'replicaset', ReplicaSetWithPrimary: 'replicaset', - Sharded: 'sharded' + Sharded: 'sharded', + LoadBalanced: 'load-balanced' }[config.topologyType]; - if (r.topologies.includes('sharded-replicaset') && topologyType === 'sharded') { + if ( + r.topologies.includes('sharded-replicaset') && + (topologyType === 'sharded' || topologyType === 'load-balanced') + ) { const shards = await utilClient.db('config').collection('shards').find({}).toArray(); ok &&= shards.length > 0 && shards.every(shard => shard.host.split(',').length > 1); } else { @@ -52,6 +56,13 @@ export async function topologySatisfies( } } + if (r.auth) { + ok &&= + !!utilClient.options.auth || + !!utilClient.options.authSource || + !!utilClient.options.authMechanism; + } + return ok; } diff --git a/test/tools/runner/config.js b/test/tools/runner/config.js index 4943a2da1b9..1b02cfa929a 100644 --- a/test/tools/runner/config.js +++ b/test/tools/runner/config.js @@ -43,6 +43,8 @@ class TestConfiguration { this.clientSideEncryption = context.clientSideEncryption; this.serverApi = context.serverApi; this.parameters = undefined; + this.singleMongosLoadBalancerUri = context.singleMongosLoadBalancerUri; + this.multiMongosLoadBalancerUri = context.multiMongosLoadBalancerUri; this.options = { hosts, hostAddresses, @@ -64,6 +66,10 @@ class TestConfiguration { return { writeConcern: { w: 1 } }; } + get isLoadBalanced() { + return !!this.singleMongosLoadBalancerUri && !!this.multiMongosLoadBalancerUri; + } + get host() { return this.options.host; } @@ -206,6 +212,10 @@ class TestConfiguration { if (options.username) url.username = options.username; if (options.password) url.password = options.password; + if (this.isLoadBalanced) { + url.searchParams.append('loadBalanced', true); + } + if (options.username || options.password) { if (options.authMechanism) { url.searchParams.append('authMechanism', options.authMechanism); diff --git a/test/tools/runner/index.js b/test/tools/runner/index.js index 313f72688e1..08a51f90f88 100644 --- a/test/tools/runner/index.js +++ b/test/tools/runner/index.js @@ -10,6 +10,10 @@ const wtfnode = require('wtfnode'); const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; const MONGODB_API_VERSION = process.env.MONGODB_API_VERSION; +// Load balancer fronting 1 mongos. +const SINGLE_MONGOS_LB_URI = process.env.SINGLE_MONGOS_LB_URI; +// Load balancer fronting 2 mongoses. +const MULTI_MONGOS_LB_URI = process.env.MULTI_MONGOS_LB_URI; const filters = []; function initializeFilters(client, callback) { @@ -82,6 +86,11 @@ before(function (_done) { context.serverApi = MONGODB_API_VERSION; } + if (SINGLE_MONGOS_LB_URI && MULTI_MONGOS_LB_URI) { + context.singleMongosLoadBalancerUri = SINGLE_MONGOS_LB_URI; + context.multiMongosLoadBalancerUri = MULTI_MONGOS_LB_URI; + } + // replace this when mocha supports dynamic skipping with `afterEach` filterOutTests(this._runnable.parent); this.configuration = new TestConfiguration(MONGODB_URI, context); From b67af3cd8b094218ec323b23e9950151cb91f1ef Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Thu, 15 Jul 2021 23:07:10 +0200 Subject: [PATCH 3/8] test(NODE-3011): lb support spec test changes (#2906) * test: lb support spec test changes * test: don't use only in srv test --- test/functional/change_stream_spec.test.js | 3 +- .../unified-spec-runner/operations.ts | 3 +- test/spec/change-stream/README.rst | 20 +- .../{ => legacy}/change-streams-errors.json | 8 +- .../{ => legacy}/change-streams-errors.yml | 4 +- .../change-streams-resume-errorLabels.json | 54 +- .../change-streams-resume-errorLabels.yml | 18 + .../change-streams-resume-whitelist.json | 3 +- .../change-streams-resume-whitelist.yml | 1 + .../{ => legacy}/change-streams.json | 2 +- .../{ => legacy}/change-streams.yml | 2 +- .../change-stream/unified/change-streams.json | 116 ++ .../change-stream/unified/change-streams.yml | 72 + .../initial-dns-seedlist-discovery/README.rst | 14 +- .../loadBalanced-replicaSet-errors.json | 7 + .../loadBalanced-replicaSet-errors.yml | 6 + .../loadBalanced-true-multiple-hosts.json | 7 + .../loadBalanced-true-multiple-hosts.yml | 5 + .../loadBalanced-true-txt.json | 13 + .../loadBalanced-true-txt.yml | 10 + test/spec/load-balancers/README.rst | 68 + test/spec/load-balancers/cursors.json | 1228 +++++++++++++ test/spec/load-balancers/cursors.yml | 503 ++++++ .../spec/load-balancers/event-monitoring.json | 184 ++ test/spec/load-balancers/event-monitoring.yml | 99 + .../lb-connection-establishment.json | 58 + .../lb-connection-establishment.yml | 36 + .../non-lb-connection-establishment.json | 92 + .../non-lb-connection-establishment.yml | 56 + .../load-balancers/sdam-error-handling.json | 508 ++++++ .../load-balancers/sdam-error-handling.yml | 270 +++ .../spec/load-balancers/server-selection.json | 82 + test/spec/load-balancers/server-selection.yml | 50 + test/spec/load-balancers/transactions.json | 1606 +++++++++++++++++ test/spec/load-balancers/transactions.yml | 592 ++++++ .../load-balancers/wait-queue-timeouts.json | 153 ++ .../load-balancers/wait-queue-timeouts.yml | 82 + test/spec/retryable-reads/README.rst | 23 +- .../aggregate-serverErrors.json | 3 +- .../aggregate-serverErrors.yml | 2 +- test/spec/retryable-reads/aggregate.json | 3 +- test/spec/retryable-reads/aggregate.yml | 2 +- ...angeStreams-client.watch-serverErrors.json | 3 +- ...hangeStreams-client.watch-serverErrors.yml | 2 +- .../changeStreams-client.watch.json | 3 +- .../changeStreams-client.watch.yml | 2 +- ...ngeStreams-db.coll.watch-serverErrors.json | 3 +- ...angeStreams-db.coll.watch-serverErrors.yml | 2 +- .../changeStreams-db.coll.watch.json | 3 +- .../changeStreams-db.coll.watch.yml | 2 +- .../changeStreams-db.watch-serverErrors.json | 3 +- .../changeStreams-db.watch-serverErrors.yml | 2 +- .../changeStreams-db.watch.json | 3 +- .../changeStreams-db.watch.yml | 2 +- .../retryable-reads/count-serverErrors.json | 3 +- .../retryable-reads/count-serverErrors.yml | 2 +- test/spec/retryable-reads/count.json | 3 +- test/spec/retryable-reads/count.yml | 2 +- .../countDocuments-serverErrors.json | 3 +- .../countDocuments-serverErrors.yml | 2 +- test/spec/retryable-reads/countDocuments.json | 3 +- test/spec/retryable-reads/countDocuments.yml | 2 +- .../distinct-serverErrors.json | 3 +- .../retryable-reads/distinct-serverErrors.yml | 2 +- test/spec/retryable-reads/distinct.json | 3 +- test/spec/retryable-reads/distinct.yml | 2 +- .../retryable-reads/find-serverErrors.json | 3 +- .../retryable-reads/find-serverErrors.yml | 2 +- test/spec/retryable-reads/find.json | 3 +- test/spec/retryable-reads/find.yml | 2 +- .../retryable-reads/findOne-serverErrors.json | 3 +- .../retryable-reads/findOne-serverErrors.yml | 2 +- test/spec/retryable-reads/findOne.json | 3 +- test/spec/retryable-reads/findOne.yml | 2 +- .../gridfs-download-serverErrors.json | 3 +- .../gridfs-download-serverErrors.yml | 2 +- .../spec/retryable-reads/gridfs-download.json | 3 +- test/spec/retryable-reads/gridfs-download.yml | 2 +- .../gridfs-downloadByName-serverErrors.json | 3 +- .../gridfs-downloadByName-serverErrors.yml | 2 +- .../gridfs-downloadByName.json | 3 +- .../retryable-reads/gridfs-downloadByName.yml | 2 +- .../listCollectionNames-serverErrors.json | 3 +- .../listCollectionNames-serverErrors.yml | 2 +- .../retryable-reads/listCollectionNames.json | 3 +- .../retryable-reads/listCollectionNames.yml | 2 +- .../listCollectionObjects-serverErrors.json | 3 +- .../listCollectionObjects-serverErrors.yml | 2 +- .../listCollectionObjects.json | 3 +- .../retryable-reads/listCollectionObjects.yml | 2 +- .../listCollections-serverErrors.json | 3 +- .../listCollections-serverErrors.yml | 2 +- .../spec/retryable-reads/listCollections.json | 3 +- test/spec/retryable-reads/listCollections.yml | 2 +- .../listDatabaseNames-serverErrors.json | 3 +- .../listDatabaseNames-serverErrors.yml | 2 +- .../retryable-reads/listDatabaseNames.json | 3 +- .../retryable-reads/listDatabaseNames.yml | 2 +- .../listDatabaseObjects-serverErrors.json | 3 +- .../listDatabaseObjects-serverErrors.yml | 2 +- .../retryable-reads/listDatabaseObjects.json | 3 +- .../retryable-reads/listDatabaseObjects.yml | 2 +- .../listDatabases-serverErrors.json | 3 +- .../listDatabases-serverErrors.yml | 2 +- test/spec/retryable-reads/listDatabases.json | 3 +- test/spec/retryable-reads/listDatabases.yml | 2 +- .../listIndexNames-serverErrors.json | 3 +- .../listIndexNames-serverErrors.yml | 2 +- test/spec/retryable-reads/listIndexNames.json | 3 +- test/spec/retryable-reads/listIndexNames.yml | 2 +- .../listIndexes-serverErrors.json | 3 +- .../listIndexes-serverErrors.yml | 2 +- test/spec/retryable-reads/listIndexes.json | 3 +- test/spec/retryable-reads/listIndexes.yml | 2 +- test/spec/retryable-reads/mapReduce.json | 3 +- test/spec/retryable-reads/mapReduce.yml | 2 +- test/spec/retryable-writes/README.rst | 14 +- .../bulkWrite-errorLabels.json | 3 +- .../bulkWrite-errorLabels.yml | 2 +- .../bulkWrite-serverErrors.json | 3 +- .../bulkWrite-serverErrors.yml | 2 +- test/spec/retryable-writes/deleteMany.json | 3 +- test/spec/retryable-writes/deleteMany.yml | 2 +- .../deleteOne-errorLabels.json | 3 +- .../deleteOne-errorLabels.yml | 2 +- .../deleteOne-serverErrors.json | 3 +- .../deleteOne-serverErrors.yml | 2 +- .../findOneAndDelete-errorLabels.json | 3 +- .../findOneAndDelete-errorLabels.yml | 2 +- .../findOneAndDelete-serverErrors.json | 3 +- .../findOneAndDelete-serverErrors.yml | 2 +- .../findOneAndReplace-errorLabels.json | 3 +- .../findOneAndReplace-errorLabels.yml | 2 +- .../findOneAndReplace-serverErrors.json | 3 +- .../findOneAndReplace-serverErrors.yml | 2 +- .../findOneAndUpdate-errorLabels.json | 3 +- .../findOneAndUpdate-errorLabels.yml | 2 +- .../findOneAndUpdate-serverErrors.json | 3 +- .../findOneAndUpdate-serverErrors.yml | 2 +- .../insertMany-errorLabels.json | 3 +- .../insertMany-errorLabels.yml | 2 +- .../insertMany-serverErrors.json | 3 +- .../insertMany-serverErrors.yml | 2 +- .../insertOne-errorLabels.json | 3 +- .../insertOne-errorLabels.yml | 2 +- .../insertOne-serverErrors.json | 3 +- .../insertOne-serverErrors.yml | 2 +- .../replaceOne-errorLabels.json | 3 +- .../replaceOne-errorLabels.yml | 2 +- .../replaceOne-serverErrors.json | 3 +- .../replaceOne-serverErrors.yml | 2 +- test/spec/retryable-writes/updateMany.json | 3 +- test/spec/retryable-writes/updateMany.yml | 2 +- .../updateOne-errorLabels.json | 3 +- .../updateOne-errorLabels.yml | 2 +- .../updateOne-serverErrors.json | 3 +- .../updateOne-serverErrors.yml | 2 +- .../load-balanced/discover_load_balancer.json | 28 + .../load-balanced/discover_load_balancer.yml | 22 + .../monitoring/load_balancer.json | 93 + .../monitoring/load_balancer.yml | 65 + .../LoadBalanced/read/Nearest.json | 35 + .../LoadBalanced/read/Nearest.yml | 16 + .../LoadBalanced/read/Primary.json | 30 + .../LoadBalanced/read/Primary.yml | 14 + .../LoadBalanced/read/PrimaryPreferred.json | 35 + .../LoadBalanced/read/PrimaryPreferred.yml | 16 + .../LoadBalanced/read/Secondary.json | 35 + .../LoadBalanced/read/Secondary.yml | 16 + .../LoadBalanced/read/SecondaryPreferred.json | 35 + .../LoadBalanced/read/SecondaryPreferred.yml | 16 + .../LoadBalanced/write/Nearest.json | 35 + .../LoadBalanced/write/Nearest.yml | 16 + .../LoadBalanced/write/Primary.json | 30 + .../LoadBalanced/write/Primary.yml | 14 + .../LoadBalanced/write/PrimaryPreferred.json | 35 + .../LoadBalanced/write/PrimaryPreferred.yml | 16 + .../LoadBalanced/write/Secondary.json | 35 + .../LoadBalanced/write/Secondary.yml | 16 + .../write/SecondaryPreferred.json | 35 + .../LoadBalanced/write/SecondaryPreferred.yml | 16 + ...client-storeEventsAsEntities-minItems.json | 18 + ...-client-storeEventsAsEntities-minItems.yml | 12 + ...ity-client-storeEventsAsEntities-type.json | 18 + ...tity-client-storeEventsAsEntities-type.yml | 12 + ...ectionCheckOutFailedEvent-reason-type.json | 23 + ...nectionCheckOutFailedEvent-reason-type.yml | 13 + ...kOutStartedEvent-additionalProperties.json | 23 + ...ckOutStartedEvent-additionalProperties.yml | 13 + ...onCheckedInEvent-additionalProperties.json | 23 + ...ionCheckedInEvent-additionalProperties.yml | 13 + ...nCheckedOutEvent-additionalProperties.json | 23 + ...onCheckedOutEvent-additionalProperties.yml | 13 + ...ent-connectionClosedEvent-reason-type.json | 23 + ...vent-connectionClosedEvent-reason-type.yml | 13 + ...tionCreatedEvent-additionalProperties.json | 23 + ...ctionCreatedEvent-additionalProperties.yml | 13 + ...ectionReadyEvent-additionalProperties.json | 23 + ...nectionReadyEvent-additionalProperties.yml | 13 + ...nt-poolClearedEvent-hasServiceId-type.json | 23 + ...ent-poolClearedEvent-hasServiceId-type.yml | 13 + ...-poolClosedEvent-additionalProperties.json | 23 + ...t-poolClosedEvent-additionalProperties.yml | 13 + ...poolCreatedEvent-additionalProperties.json | 23 + ...-poolCreatedEvent-additionalProperties.yml | 13 + ...t-poolReadyEvent-additionalProperties.json | 23 + ...nt-poolReadyEvent-additionalProperties.yml | 13 + ...ctedCommandEvent-additionalProperties.json | 27 + ...ectedCommandEvent-additionalProperties.yml | 15 + ...t-commandFailedEvent-commandName-type.json | 29 + ...nt-commandFailedEvent-commandName-type.yml | 16 + ...-commandFailedEvent-hasServiceId-type.json | 29 + ...t-commandFailedEvent-hasServiceId-type.yml | 16 + ...mandStartedEvent-additionalProperties.json | 29 + ...mmandStartedEvent-additionalProperties.yml | 16 + ...vent-commandStartedEvent-command-type.json | 29 + ...Event-commandStartedEvent-command-type.yml | 16 + ...-commandStartedEvent-commandName-type.json | 29 + ...t-commandStartedEvent-commandName-type.yml | 16 + ...commandStartedEvent-databaseName-type.json | 29 + ...-commandStartedEvent-databaseName-type.yml | 16 + ...commandStartedEvent-hasServiceId-type.json | 29 + ...-commandStartedEvent-hasServiceId-type.yml | 16 + ...ommandSucceededEvent-commandName-type.json | 29 + ...commandSucceededEvent-commandName-type.yml | 16 + ...mmandSucceededEvent-hasServiceId-type.json | 29 + ...ommandSucceededEvent-hasServiceId-type.yml | 16 + ...vent-commandSucceededEvent-reply-type.json | 29 + ...Event-commandSucceededEvent-reply-type.yml | 16 + .../expectedCommandEvent-maxProperties.json | 28 + .../expectedCommandEvent-maxProperties.yml | 16 + .../expectedCommandEvent-minProperties.json | 25 + .../expectedCommandEvent-minProperties.yml | 15 + ...dEventsForClient-additionalProperties.json | 15 +- ...edEventsForClient-additionalProperties.yml | 12 +- ...pectedEventsForClient-client-required.json | 11 +- ...xpectedEventsForClient-client-required.yml | 8 +- .../expectedEventsForClient-client-type.json | 13 +- .../expectedEventsForClient-client-type.yml | 10 +- ...xpectedEventsForClient-eventType-enum.json | 24 + ...expectedEventsForClient-eventType-enum.yml | 15 + ...xpectedEventsForClient-eventType-type.json | 24 + ...expectedEventsForClient-eventType-type.yml | 15 + .../expectedEventsForClient-events-items.json | 15 +- .../expectedEventsForClient-events-items.yml | 10 +- ...pectedEventsForClient-events-required.json | 11 +- ...xpectedEventsForClient-events-required.yml | 8 +- .../expectedEventsForClient-events-type.json | 13 +- .../expectedEventsForClient-events-type.yml | 10 +- ...-events_conflicts_with_cmap_eventType.json | 28 + ...t-events_conflicts_with_cmap_eventType.yml | 16 + ...ents_conflicts_with_command_eventType.json | 28 + ...vents_conflicts_with_command_eventType.yml | 16 + ...ents_conflicts_with_default_eventType.json | 27 + ...vents_conflicts_with_default_eventType.yml | 15 + ...ltAndError-conflicts_with_expectError.json | 19 + ...ultAndError-conflicts_with_expectError.yml | 12 + ...tAndError-conflicts_with_expectResult.json | 17 + ...ltAndError-conflicts_with_expectResult.yml | 11 + ...ror-conflicts_with_saveResultAsEntity.json | 17 + ...rror-conflicts_with_saveResultAsEntity.yml | 11 + .../invalid/runOnRequirement-auth-type.json | 15 + .../invalid/runOnRequirement-auth-type.yml | 10 + ...reEventsAsEntity-additionalProperties.json | 26 + ...oreEventsAsEntity-additionalProperties.yml | 15 + .../storeEventsAsEntity-events-enum.json | 25 + .../storeEventsAsEntity-events-enum.yml | 14 + .../storeEventsAsEntity-events-minItems.json | 23 + .../storeEventsAsEntity-events-minItems.yml | 14 + .../storeEventsAsEntity-events-required.json | 22 + .../storeEventsAsEntity-events-required.yml | 13 + .../storeEventsAsEntity-events-type.json | 23 + .../storeEventsAsEntity-events-type.yml | 14 + .../storeEventsAsEntity-id-required.json | 24 + .../storeEventsAsEntity-id-required.yml | 13 + .../invalid/storeEventsAsEntity-id-type.json | 25 + .../invalid/storeEventsAsEntity-id-type.yml | 14 + .../assertNumberConnectionsCheckedOut.json | 63 + .../assertNumberConnectionsCheckedOut.yml | 38 + ...ntsAsEntities-conflict_with_client_id.json | 28 + ...entsAsEntities-conflict_with_client_id.yml | 16 + ...ities-conflict_within_different_array.json | 43 + ...tities-conflict_within_different_array.yml | 19 + ...AsEntities-conflict_within_same_array.json | 36 + ...sAsEntities-conflict_within_same_array.yml | 16 + .../valid-fail/entity-find-cursor.json | 62 + .../valid-fail/entity-find-cursor.yml | 37 + .../valid-fail/ignoreResultAndError.json | 72 + .../valid-fail/ignoreResultAndError.yml | 43 + .../valid-fail/operation-failure.json | 56 + .../valid-fail/operation-failure.yml | 31 + .../assertNumberConnectionsCheckedOut.json | 27 + .../assertNumberConnectionsCheckedOut.yml | 17 + .../valid-pass/entity-client-cmap-events.json | 71 + .../valid-pass/entity-client-cmap-events.yml | 40 + .../entity-client-storeEventsAsEntities.json | 67 + .../entity-client-storeEventsAsEntities.yml | 37 + .../valid-pass/entity-find-cursor.json | 182 ++ .../valid-pass/entity-find-cursor.yml | 89 + .../expectedEventsForClient-eventType.json | 126 ++ .../expectedEventsForClient-eventType.yml | 66 + .../valid-pass/ignoreResultAndError.json | 59 + .../valid-pass/ignoreResultAndError.yml | 34 + .../valid-pass/poc-command-monitoring.json | 3 +- .../valid-pass/poc-command-monitoring.yml | 3 +- .../valid-pass/poc-crud.json | 446 ----- .../valid-pass/poc-crud.yml | 183 -- .../valid-pass/poc-retryable-reads.yml | 6 +- .../valid-pass/poc-retryable-writes.yml | 4 +- test/spec/uri-options/connection-options.json | 67 + test/spec/uri-options/connection-options.yml | 58 + test/spec/versioned-api/README.rst | 37 + test/unit/core/mongodb_srv.test.js | 4 +- test/unit/sdam/server_selection/spec.test.js | 8 +- test/unit/sdam/spec.test.js | 5 +- 315 files changed, 10133 insertions(+), 890 deletions(-) rename test/spec/change-stream/{ => legacy}/change-streams-errors.json (96%) rename test/spec/change-stream/{ => legacy}/change-streams-errors.yml (97%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-errorLabels.json (98%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-errorLabels.yml (98%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-whitelist.json (99%) rename test/spec/change-stream/{ => legacy}/change-streams-resume-whitelist.yml (99%) rename test/spec/change-stream/{ => legacy}/change-streams.json (99%) rename test/spec/change-stream/{ => legacy}/change-streams.yml (99%) create mode 100644 test/spec/change-stream/unified/change-streams.json create mode 100644 test/spec/change-stream/unified/change-streams.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json create mode 100644 test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml create mode 100644 test/spec/load-balancers/README.rst create mode 100644 test/spec/load-balancers/cursors.json create mode 100644 test/spec/load-balancers/cursors.yml create mode 100644 test/spec/load-balancers/event-monitoring.json create mode 100644 test/spec/load-balancers/event-monitoring.yml create mode 100644 test/spec/load-balancers/lb-connection-establishment.json create mode 100644 test/spec/load-balancers/lb-connection-establishment.yml create mode 100644 test/spec/load-balancers/non-lb-connection-establishment.json create mode 100644 test/spec/load-balancers/non-lb-connection-establishment.yml create mode 100644 test/spec/load-balancers/sdam-error-handling.json create mode 100644 test/spec/load-balancers/sdam-error-handling.yml create mode 100644 test/spec/load-balancers/server-selection.json create mode 100644 test/spec/load-balancers/server-selection.yml create mode 100644 test/spec/load-balancers/transactions.json create mode 100644 test/spec/load-balancers/transactions.yml create mode 100644 test/spec/load-balancers/wait-queue-timeouts.json create mode 100644 test/spec/load-balancers/wait-queue-timeouts.yml create mode 100644 test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json create mode 100644 test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml create mode 100644 test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json create mode 100644 test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json create mode 100644 test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json create mode 100644 test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json create mode 100644 test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json create mode 100644 test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json create mode 100644 test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json create mode 100644 test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml create mode 100644 test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json create mode 100644 test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml create mode 100644 test/spec/unified-test-format/valid-fail/entity-find-cursor.json create mode 100644 test/spec/unified-test-format/valid-fail/entity-find-cursor.yml create mode 100644 test/spec/unified-test-format/valid-fail/ignoreResultAndError.json create mode 100644 test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml create mode 100644 test/spec/unified-test-format/valid-fail/operation-failure.json create mode 100644 test/spec/unified-test-format/valid-fail/operation-failure.yml create mode 100644 test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json create mode 100644 test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml create mode 100644 test/spec/unified-test-format/valid-pass/entity-find-cursor.json create mode 100644 test/spec/unified-test-format/valid-pass/entity-find-cursor.yml create mode 100644 test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json create mode 100644 test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml create mode 100644 test/spec/unified-test-format/valid-pass/ignoreResultAndError.json create mode 100644 test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml delete mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.json delete mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.yml create mode 100644 test/spec/versioned-api/README.rst diff --git a/test/functional/change_stream_spec.test.js b/test/functional/change_stream_spec.test.js index 57a47239992..d124f46c82b 100644 --- a/test/functional/change_stream_spec.test.js +++ b/test/functional/change_stream_spec.test.js @@ -1,5 +1,6 @@ 'use strict'; +const path = require('path'); const chai = require('chai'); const loadSpecTests = require('../spec').loadSpecTests; const camelCase = require('lodash.camelcase'); @@ -28,7 +29,7 @@ describe('Change Stream Spec', function () { return new Promise(r => gc.close(() => r())); }); - loadSpecTests('change-stream').forEach(suite => { + loadSpecTests(path.join('change-stream', 'legacy')).forEach(suite => { const ALL_DBS = [suite.database_name, suite.database2_name]; describe(suite.name, () => { diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index 40aa0f864ab..a4dda6f5ed8 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -180,7 +180,8 @@ operations.set('assertNumberConnectionsCheckedOut', async ({ entities, operation const pool = server.s.pool; return count + pool.currentCheckedOutCount; }, 0); - expect(checkedOutConnections).to.equal(operation.arguments.connections); + // TODO: Durran: Fix in NODE-3011 + expect(checkedOutConnections || 0).to.equal(operation.arguments.connections); }); operations.set('bulkWrite', async ({ entities, operation }) => { diff --git a/test/spec/change-stream/README.rst b/test/spec/change-stream/README.rst index 1dff2b66195..4e3bfbc94aa 100644 --- a/test/spec/change-stream/README.rst +++ b/test/spec/change-stream/README.rst @@ -18,6 +18,15 @@ drivers can use to prove their conformance to the Change Streams Spec. Several prose tests, which are not easily expressed in YAML, are also presented in this file. Those tests will need to be manually implemented by each driver. +Subdirectories for Test Formats +------------------------------- + +This document describes the legacy format for change streams tests. +Tests in this legacy format are located under ``./legacy/``. + +New change streams tests should be written in the `unified test format <../../unified-test-format/unified-test-format.rst>`__ +and placed under ``./unified/``. + Spec Test Format ================ @@ -33,14 +42,14 @@ Each YAML file has the following keys: - ``description``: The name of the test. - ``minServerVersion``: The minimum server version to run this test against. If not present, assume there is no minimum server version. - ``maxServerVersion``: Reserved for later use - - ``failPoint``(optional): The configureFailPoint command document to run to configure a fail point on the primary server. + - ``failPoint``: Optional configureFailPoint command document to run to configure a fail point on the primary server. - ``target``: The entity on which to run the change stream. Valid values are: - ``collection``: Watch changes on collection ``database_name.collection_name`` - ``database``: Watch changes on database ``database_name`` - ``client``: Watch changes on entire clusters - ``topology``: An array of server topologies against which to run the test. - Valid topologies are ``single``, ``replicaset``, and ``sharded``. + Valid topologies are ``single``, ``replicaset``, ``sharded``, and "load-balanced". - ``changeStreamPipeline``: An array of additional aggregation pipeline stages to add to the change stream - ``changeStreamOptions``: Additional options to add to the changeStream - ``operations``: Array of documents, each describing an operation. Each document has the following fields: @@ -133,6 +142,11 @@ For each YAML file, for each element in ``tests``: - For each (``expected``, ``idx``) in ``expectations`` - If ``actual[idx]`` is a ``killCursors`` event, skip it and move to ``actual[idx+1]``. - Else assert that ``actual[idx]`` MATCHES ``expected`` + - Note: the change stream test command event expectations cover a + prefix subset of all command events published by the driver. + The test runner MUST verify that, if there are N expectations, that the + first N events published by the driver match the expectations, and + MUST NOT inspect any subsequent events published by the driver. - Close the MongoClient ``client`` @@ -171,7 +185,7 @@ The following tests have not yet been automated, but MUST still be tested. All t #. ``ChangeStream`` must continuously track the last seen ``resumeToken`` #. ``ChangeStream`` will throw an exception if the server response is missing the resume token (if wire version is < 8, this is a driver-side error; for 8+, this is a server-side error) #. After receiving a ``resumeToken``, ``ChangeStream`` will automatically resume one time on a resumable error with the initial pipeline and options, except for the addition/update of a ``resumeToken``. -#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify `retryReads=false` or avoid using a [retryable error](../../retryable-reads/retryable-reads.rst#retryable-error) for this test. +#. ``ChangeStream`` will not attempt to resume on any error encountered while executing an ``aggregate`` command. Note that retryable reads may retry ``aggregate`` commands. Drivers should be careful to distinguish retries from resume attempts. Alternatively, drivers may specify ``retryReads=false`` or avoid using a `retryable error <../../retryable-reads/retryable-reads.rst#retryable-error>`_ for this test. #. **Removed** #. ``ChangeStream`` will perform server selection before attempting to resume, using initial ``readPreference`` #. Ensure that a cursor returned from an aggregate command with a cursor id and an initial empty batch is not closed on the driver side. diff --git a/test/spec/change-stream/change-streams-errors.json b/test/spec/change-stream/legacy/change-streams-errors.json similarity index 96% rename from test/spec/change-stream/change-streams-errors.json rename to test/spec/change-stream/legacy/change-streams-errors.json index 19cbc742880..7b3fa80689c 100644 --- a/test/spec/change-stream/change-streams-errors.json +++ b/test/spec/change-stream/legacy/change-streams-errors.json @@ -14,7 +14,7 @@ "changeStreamPipeline": [], "changeStreamOptions": {}, "operations": [], - "expectations": [], + "expectations": null, "result": { "error": { "code": 40573 @@ -78,7 +78,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [ { @@ -125,7 +126,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-errors.yml b/test/spec/change-stream/legacy/change-streams-errors.yml similarity index 97% rename from test/spec/change-stream/change-streams-errors.yml rename to test/spec/change-stream/legacy/change-streams-errors.yml index 2e518c1e362..661ccabdb14 100644 --- a/test/spec/change-stream/change-streams-errors.yml +++ b/test/spec/change-stream/legacy/change-streams-errors.yml @@ -12,7 +12,7 @@ tests: changeStreamPipeline: [] changeStreamOptions: {} operations: [] - expectations: [] + expectations: ~ result: error: code: 40573 @@ -57,6 +57,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: - $project: { _id: 0 } @@ -86,6 +87,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams-resume-errorLabels.json b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.json similarity index 98% rename from test/spec/change-stream/change-streams-resume-errorLabels.json rename to test/spec/change-stream/legacy/change-streams-resume-errorLabels.json index cf8957b21f2..4d1f52d9724 100644 --- a/test/spec/change-stream/change-streams-resume-errorLabels.json +++ b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.json @@ -18,7 +18,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -111,7 +112,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -204,7 +206,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -297,7 +300,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -390,7 +394,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -483,7 +488,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -576,7 +582,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -669,7 +676,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -762,7 +770,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -855,7 +864,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -948,7 +958,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1041,7 +1052,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1134,7 +1146,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1227,7 +1240,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1320,7 +1334,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1413,7 +1428,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1512,7 +1528,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, @@ -1608,7 +1625,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-resume-errorLabels.yml b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml similarity index 98% rename from test/spec/change-stream/change-streams-resume-errorLabels.yml rename to test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml index 94570a1457a..91e1ae8913e 100644 --- a/test/spec/change-stream/change-streams-resume-errorLabels.yml +++ b/test/spec/change-stream/legacy/change-streams-resume-errorLabels.yml @@ -15,6 +15,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -78,6 +79,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -141,6 +143,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -204,6 +207,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -267,6 +271,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -330,6 +335,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -393,6 +399,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -456,6 +463,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -519,6 +527,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -582,6 +591,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -645,6 +655,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -708,6 +719,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -771,6 +783,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -834,6 +847,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -897,6 +911,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -960,6 +975,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -1026,6 +1042,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: @@ -1090,6 +1107,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams-resume-whitelist.json b/test/spec/change-stream/legacy/change-streams-resume-whitelist.json similarity index 99% rename from test/spec/change-stream/change-streams-resume-whitelist.json rename to test/spec/change-stream/legacy/change-streams-resume-whitelist.json index 39f883ee5ec..76920d8d3b9 100644 --- a/test/spec/change-stream/change-streams-resume-whitelist.json +++ b/test/spec/change-stream/legacy/change-streams-resume-whitelist.json @@ -20,7 +20,8 @@ "target": "collection", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ], "changeStreamPipeline": [], "changeStreamOptions": {}, diff --git a/test/spec/change-stream/change-streams-resume-whitelist.yml b/test/spec/change-stream/legacy/change-streams-resume-whitelist.yml similarity index 99% rename from test/spec/change-stream/change-streams-resume-whitelist.yml rename to test/spec/change-stream/legacy/change-streams-resume-whitelist.yml index 2d92f295913..b851ac9eb59 100644 --- a/test/spec/change-stream/change-streams-resume-whitelist.yml +++ b/test/spec/change-stream/legacy/change-streams-resume-whitelist.yml @@ -15,6 +15,7 @@ tests: topology: - replicaset - sharded + - load-balanced changeStreamPipeline: [] changeStreamOptions: {} operations: diff --git a/test/spec/change-stream/change-streams.json b/test/spec/change-stream/legacy/change-streams.json similarity index 99% rename from test/spec/change-stream/change-streams.json rename to test/spec/change-stream/legacy/change-streams.json index 4aeb2c7f70c..54b76af0a3d 100644 --- a/test/spec/change-stream/change-streams.json +++ b/test/spec/change-stream/legacy/change-streams.json @@ -82,7 +82,7 @@ } } ], - "expectations": [], + "expectations": null, "result": { "success": [ { diff --git a/test/spec/change-stream/change-streams.yml b/test/spec/change-stream/legacy/change-streams.yml similarity index 99% rename from test/spec/change-stream/change-streams.yml rename to test/spec/change-stream/legacy/change-streams.yml index 8037e9913ea..52009447732 100644 --- a/test/spec/change-stream/change-streams.yml +++ b/test/spec/change-stream/legacy/change-streams.yml @@ -58,7 +58,7 @@ tests: arguments: document: x: 1 - expectations: [] + expectations: ~ result: success: - diff --git a/test/spec/change-stream/unified/change-streams.json b/test/spec/change-stream/unified/change-streams.json new file mode 100644 index 00000000000..adaf00de2d9 --- /dev/null +++ b/test/spec/change-stream/unified/change-streams.json @@ -0,0 +1,116 @@ +{ + "description": "change-streams", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "collection0" + } + } + ], + "initialData": [ + { + "collectionName": "collection0", + "databaseName": "database0", + "documents": [] + } + ], + "tests": [ + { + "description": "Test array truncation", + "runOnRequirements": [ + { + "minServerVersion": "4.7", + "topologies": [ + "replicaset" + ] + } + ], + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": 1, + "array": [ + "foo", + { + "a": "bar" + }, + 1, + 2, + 3 + ] + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$set": { + "array": [ + "foo", + { + "a": "bar" + } + ] + } + } + ] + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "updateDescription": { + "updatedFields": {}, + "removedFields": [], + "truncatedArrays": [ + { + "field": "array", + "newSize": 2 + } + ] + } + } + } + ] + } + ] +} diff --git a/test/spec/change-stream/unified/change-streams.yml b/test/spec/change-stream/unified/change-streams.yml new file mode 100644 index 00000000000..d8567db473e --- /dev/null +++ b/test/spec/change-stream/unified/change-streams.yml @@ -0,0 +1,72 @@ +description: "change-streams" +schemaVersion: "1.0" +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: *database0 + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: *collection0 +initialData: + - collectionName: *collection0 + databaseName: *database0 + documents: [] +tests: + - description: "Test array truncation" + runOnRequirements: + - minServerVersion: "4.7" + topologies: [replicaset] + operations: + - name: insertOne + object: *collection0 + arguments: + document: { + "_id": 1, + "a": 1, + "array": ["foo", {"a": "bar"}, 1, 2, 3] + } + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + saveResultAsEntity: &changeStream0 changeStream0 + - name: updateOne + object: *collection0 + arguments: + filter: { + "_id": 1 + } + update: [ + { + "$set": { + "array": ["foo", {"a": "bar"}] + } + } + ] + - name: iterateUntilDocumentOrError + object: *changeStream0 + expectResult: { + "operationType": "update", + "ns": { + "db": "database0", + "coll": "collection0" + }, + # It is up to the MongoDB server to decide how to report a change. + # This expectation is based on the current MongoDB server behavior. + # Alternatively, we could have used a set of possible expectations of which only one + # must be satisfied, but the unified test format does not support this. + "updateDescription": { + "updatedFields": {}, + "removedFields": [], + "truncatedArrays": [ + { + "field": "array", + "newSize": 2 + } + ] + } + } diff --git a/test/spec/initial-dns-seedlist-discovery/README.rst b/test/spec/initial-dns-seedlist-discovery/README.rst index 6072deb7381..47bb75b4f67 100644 --- a/test/spec/initial-dns-seedlist-discovery/README.rst +++ b/test/spec/initial-dns-seedlist-discovery/README.rst @@ -8,9 +8,13 @@ to prove their conformance to the Initial DNS Seedlist Discovery spec. Test Setup ---------- -Start a three-node replica set on localhost, on ports 27017, 27018, and 27019, -with replica set name "repl0". The replica set MUST be started with SSL -enabled. +The tests in the ``replica-set`` directory MUST be executed against a +three-node replica set on localhost ports 27017, 27018, and 27019 with +replica set name ``repl0``. The tests in ``load-balanced`` MUST be executed +against a load-balanced sharded cluster with the mongos servers running on +localhost ports 27017 and 27018 and load balancers, shard servers, and config +servers running on any open ports. In both cases, the clusters MUST be +started with SSL enabled. To run the tests that accompany this spec, you need to configure the SRV and TXT records with a real name server. The following records are required for @@ -41,6 +45,8 @@ these tests:: _mongodb._tcp.test18.test.build.10gen.cc. 86400 IN SRV 27017 localhost.sub.test.build.10gen.cc. _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.evil.build.10gen.cc. _mongodb._tcp.test19.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. + _mongodb._tcp.test20.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. + _mongodb._tcp.test21.test.build.10gen.cc. 86400 IN SRV 27017 localhost.test.build.10gen.cc. Record TTL Class Text test5.test.build.10gen.cc. 86400 IN TXT "replicaSet=repl0&authSource=thisDB" @@ -50,6 +56,8 @@ these tests:: test8.test.build.10gen.cc. 86400 IN TXT "authSource" test10.test.build.10gen.cc. 86400 IN TXT "socketTimeoutMS=500" test11.test.build.10gen.cc. 86400 IN TXT "replicaS" "et=rep" "l0" + test20.test.build.10gen.cc. 86400 IN TXT "loadBalanced=true" + test21.test.build.10gen.cc. 86400 IN TXT "loadBalanced=false" Note that ``test4`` is omitted deliberately to test what happens with no SRV record. ``test9`` is missing because it was deleted during the development of diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json new file mode 100644 index 00000000000..9ed5ff22c22 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.json @@ -0,0 +1,7 @@ +{ + "uri": "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset", + "seeds": [], + "hosts": [], + "error": true, + "comment": "Should fail because loadBalanced=true is incompatible with replicaSet" +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml new file mode 100644 index 00000000000..208c6a97390 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-replicaSet-errors.yml @@ -0,0 +1,6 @@ +# The TXT record for test20.test.build.10gen.cc contains loadBalanced=true. +uri: "mongodb+srv://test20.test.build.10gen.cc/?replicaSet=replset" +seeds: [] +hosts: [] +error: true +comment: Should fail because loadBalanced=true is incompatible with replicaSet diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json new file mode 100644 index 00000000000..f425c06b305 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.json @@ -0,0 +1,7 @@ +{ + "uri": "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true", + "seeds": [], + "hosts": [], + "error": true, + "comment": "Should fail because loadBalanced is true but the SRV record resolves to multiple hosts" +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml new file mode 100644 index 00000000000..c8276c1b7ec --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-multiple-hosts.yml @@ -0,0 +1,5 @@ +uri: "mongodb+srv://test1.test.build.10gen.cc/?loadBalanced=true" +seeds: [] +hosts: [] +error: true +comment: Should fail because loadBalanced is true but the SRV record resolves to multiple hosts diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json new file mode 100644 index 00000000000..0117b3e9cba --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.json @@ -0,0 +1,13 @@ +{ + "uri": "mongodb+srv://test20.test.build.10gen.cc/", + "seeds": [ + "localhost.test.build.10gen.cc:27017" + ], + "hosts": [ + "localhost.test.build.10gen.cc:27017" + ], + "options": { + "loadBalanced": true, + "ssl": true + } +} diff --git a/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml new file mode 100644 index 00000000000..bbf9e8c5996 --- /dev/null +++ b/test/spec/initial-dns-seedlist-discovery/loadBalanced-true-txt.yml @@ -0,0 +1,10 @@ +uri: "mongodb+srv://test20.test.build.10gen.cc/" +seeds: + - localhost.test.build.10gen.cc:27017 +hosts: + # In LB mode, the driver does not do server discovery, so the hostname does + # not get resolved to localhost:27017. + - localhost.test.build.10gen.cc:27017 +options: + loadBalanced: true + ssl: true diff --git a/test/spec/load-balancers/README.rst b/test/spec/load-balancers/README.rst new file mode 100644 index 00000000000..3975e7b0b7f --- /dev/null +++ b/test/spec/load-balancers/README.rst @@ -0,0 +1,68 @@ +=========================== +Load Balancer Support Tests +=========================== + +.. contents:: + +---- + +Introduction +============ + +This document describes how drivers should create load balanced clusters for +testing and how tests should be executed for such clusters. + +Testing Requirements +==================== + +For each server version that supports load balanced clusters, drivers MUST +add two Evergreen tasks: one with a sharded cluster with both authentication +and TLS enabled and one with a sharded cluster with authentication and TLS +disabled. In each task, the sharded cluster MUST be configured with two +mongos nodes running on localhost ports 27017 and 27018. The shard and config +servers may run on any free ports. Each task MUST also start up two TCP load +balancers operating in round-robin mode: one fronting both mongos servers and +one fronting a single mongos. + +Load Balancer Configuration +--------------------------- + +Drivers MUST use the ``run-load-balancer.sh`` script in +``drivers-evergreen-tools`` to start the TCP load balancers for Evergreen +tasks. This script MUST be run after the backing sharded cluster has already +been started. The script writes the URIs of the load balancers to a YAML +expansions file, which can be read by drivers via the ``expansions.update`` +Evergreen command. This will store the URIs into the ``SINGLE_MONGOS_LB_URI`` +and ``MULTI_MONGOS_LB_URI`` environment variables. + +Test Runner Configuration +------------------------- + +If the backing sharded cluster is configured with TLS enabled, drivers MUST +add the relevant TLS options to both ``SINGLE_MONGOS_LB_URI`` and +``MULTI_MONGOS_LB_URI`` to ensure that test clients can connect to the +cluster. Drivers MUST use the final URI stored in ``SINGLE_MONGOS_LB_URI`` +(with additional TLS options if required) to configure internal clients for +test runners (e.g. the internal MongoClient described by the `Unified Test +Format spec <../../unified-test-format/unified-test-format.rst>`__). + +In addition to modifying load balancer URIs, drivers MUST also mock server +support for returning a ``serviceId`` field in ``hello`` or legacy ``hello`` +command responses when running tests against a load-balanced cluster. This +can be done by using the value of ``topologyVersion.processId`` to set +``serviceId``. This MUST be done for all connections established by the test +runner, including those made by any internal clients. + +Tests +====== + +The YAML and JSON files in this directory contain platform-independent tests +written in the `Unified Test Format +<../../unified-test-format/unified-test-format.rst>`_. Drivers MUST run the +following test suites against a load balanced cluster: + +#. All test suites written in the Unified Test Format +#. Retryable Reads +#. Retryable Writes +#. Change Streams +#. Initial DNS Seedlist Discovery diff --git a/test/spec/load-balancers/cursors.json b/test/spec/load-balancers/cursors.json new file mode 100644 index 00000000000..43e4fbb4f61 --- /dev/null +++ b/test/spec/load-balancers/cursors.json @@ -0,0 +1,1228 @@ +{ + "description": "cursors are correctly pinned to connections for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent", + "connectionReadyEvent", + "connectionClosedEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } + }, + { + "collection": { + "id": "collection2", + "database": "database0", + "collectionName": "coll2" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + }, + { + "collectionName": "coll1", + "databaseName": "database0Name", + "documents": [] + }, + { + "collectionName": "coll2", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "no connection is pinned if all documents are returned in the initial batch", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {} + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {} + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are returned when the cursor is drained", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 3 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "close", + "object": "cursor0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are returned to the pool when the cursor is closed", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connections are not returned after an network error during getMore", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "isClientError": true + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandFailedEvent": { + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + } + ] + } + ] + }, + { + "description": "pinned connections are returned after a network error during a killCursors request", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "killCursors" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandFailedEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + } + ] + } + ] + }, + { + "description": "pinned connections are not returned to the pool after a non-network error on getMore", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 7 + } + } + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "errorCode": 7 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "firstBatch": { + "$$type": "array" + }, + "ns": { + "$$type": "string" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandFailedEvent": { + "commandName": "getMore" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "aggregate pins the cursor to a connection", + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [], + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "cursor": { + "batchSize": 2 + } + }, + "commandName": "aggregate" + } + }, + { + "commandSucceededEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "listCollections pins the cursor to a connection", + "operations": [ + { + "name": "listCollections", + "object": "database0", + "arguments": { + "filter": {}, + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "listCollections": 1, + "cursor": { + "batchSize": 2 + } + }, + "commandName": "listCollections", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "commandName": "listCollections" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": { + "$$type": "string" + } + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "listIndexes pins the cursor to a connection", + "operations": [ + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, + { + "name": "createIndex", + "object": "collection0", + "arguments": { + "keys": { + "y": 1 + }, + "name": "y_1" + } + }, + { + "name": "listIndexes", + "object": "collection0", + "arguments": { + "batchSize": 2 + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "createIndexes": "coll0", + "indexes": [ + { + "name": "x_1", + "key": { + "x": 1 + } + } + ] + }, + "commandName": "createIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "createIndexes": "coll0", + "indexes": [ + { + "name": "y_1", + "key": { + "y": 1 + } + } + ] + }, + "commandName": "createIndexes" + } + }, + { + "commandSucceededEvent": { + "commandName": "createIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "listIndexes": "coll0", + "cursor": { + "batchSize": 2 + } + }, + "commandName": "listIndexes", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "commandName": "listIndexes" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": 0, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "change streams pin to a connection", + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "changeStream0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "aggregate" + } + }, + { + "commandSucceededEvent": { + "commandName": "aggregate" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "commandName": "killCursors" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/cursors.yml b/test/spec/load-balancers/cursors.yml new file mode 100644 index 00000000000..0797d0c93a1 --- /dev/null +++ b/test/spec/load-balancers/cursors.yml @@ -0,0 +1,503 @@ +description: cursors are correctly pinned to connections for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - connectionReadyEvent + - connectionClosedEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 + - collection: + id: &collection2 collection2 + database: *database0 + collectionName: &collection2Name coll2 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: [] + - collectionName: *collection2Name + databaseName: *database0Name + documents: [] + +tests: + - description: no connection is pinned if all documents are returned in the initial batch + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + saveResultAsEntity: &cursor0 cursor0 + - &assertConnectionNotPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + commandName: find + - commandSucceededEvent: + reply: + cursor: + id: 0 + firstBatch: { $$type: array } + ns: { $$type: string } + commandName: find + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connections are returned when the cursor is drained + operations: + - &createAndSaveCursor + name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - &assertConnectionPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 1 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 2 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 3 } + - *assertConnectionNotPinned + - &closeCursor + name: close + object: *cursor0 + expectEvents: + - client: *client0 + events: + - &findWithBatchSizeStarted + commandStartedEvent: + command: + find: *collection0Name + filter: {} + batchSize: 2 + commandName: find + - &findWithBatchSizeSucceeded + commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + firstBatch: { $$type: array } + ns: { $$type: string } + commandName: find + - &getMoreStarted + commandStartedEvent: + command: + getMore: { $$type: long } + collection: *collection0Name + commandName: getMore + - &getMoreSucceeded + commandSucceededEvent: + reply: + cursor: + id: 0 + ns: { $$type: string } + nextBatch: { $$type: array } + commandName: getMore + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connections are returned to the pool when the cursor is closed + operations: + - *createAndSaveCursor + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - &killCursorsStarted + commandStartedEvent: + commandName: killCursors + - &killCursorsSucceeded + commandSucceededEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # If a network error occurs during a getMore request, the connection must remain pinned. and drivers must not + # attempt to send a killCursors command when the cursor is closed because the connection is no longer valid. + - description: pinned connections are not returned after an network error during getMore + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ getMore ] + closeConnection: true + - *createAndSaveCursor + - *assertConnectionPinned + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 2 + # Third next() call should perform a getMore. + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + # Network errors are considered client-side errors per the unified test format spec. + isClientError: true + - *assertConnectionPinned + - *closeCursor # Execute a close operation to actually release the connection. + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *getMoreStarted + - &getMoreFailed + commandFailedEvent: + commandName: getMore + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + getMore. + - connectionCheckedOutEvent: {} + # Events for the close() operation. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + + - description: pinned connections are returned after a network error during a killCursors request + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ killCursors ] + closeConnection: true + - *createAndSaveCursor + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *killCursorsStarted + - commandFailedEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + killCursors. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + + - description: pinned connections are not returned to the pool after a non-network error on getMore + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ getMore ] + errorCode: &hostNotFoundCode 7 # This is not a state change error code, so it should not cause SDAM changes. + - *createAndSaveCursor + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 1 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: + _id: 2 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + errorCode: *hostNotFoundCode + - *assertConnectionPinned + - *closeCursor + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *findWithBatchSizeStarted + - *findWithBatchSizeSucceeded + - *getMoreStarted + - *getMoreFailed + - *killCursorsStarted + - *killCursorsSucceeded + - client: *client0 + eventType: cmap + events: + # Events to set the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the find command + getMore + killCursors. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # Basic tests for cursor-creating commands besides "find". We don't need to replicate the full set of tests defined + # above for each such command. Instead, only one test is needed per command to ensure that the pinned connection is + # correctly passed down to the server. + # + # Each test creates a cursor with a small batch size and fully iterates it. Because drivers do not publish CMAP + # events when using pinned connections, each test asserts that only one set of ready/checkout/checkin events are + # published. + + - description: aggregate pins the cursor to a connection + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: [] + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + cursor: + batchSize: 2 + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - *getMoreStarted + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: listCollections pins the cursor to a connection + operations: + - name: listCollections + object: *database0 + arguments: + filter: {} + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + listCollections: 1 + cursor: + batchSize: 2 + commandName: listCollections + databaseName: *database0Name + - commandSucceededEvent: + commandName: listCollections + # Write out the event for getMore rather than using the getMoreStarted anchor because the "collection" field + # is not equal to *collection0Name as the command is not executed against a collection. + - commandStartedEvent: + command: + getMore: { $$type: long } + collection: { $$type: string } + commandName: getMore + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: listIndexes pins the cursor to a connection + operations: + # There is an automatic index on _id so we create two more indexes to force multiple batches with batchSize=2. + - name: createIndex + object: *collection0 + arguments: + keys: &x1IndexSpec { x: 1 } + name: &x1IndexName x_1 + - name: createIndex + object: *collection0 + arguments: + keys: &y1IndexSpec { y: 1 } + name: &y1IndexName y_1 + - name: listIndexes + object: *collection0 + arguments: + batchSize: 2 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + createIndexes: *collection0Name + indexes: + - name: *x1IndexName + key: *x1IndexSpec + commandName: createIndexes + - commandSucceededEvent: + commandName: createIndexes + - commandStartedEvent: + command: + createIndexes: *collection0Name + indexes: + - name: *y1IndexName + key: *y1IndexSpec + commandName: createIndexes + - commandSucceededEvent: + commandName: createIndexes + - commandStartedEvent: + command: + listIndexes: *collection0Name + cursor: + batchSize: 2 + commandName: listIndexes + databaseName: *database0Name + - commandSucceededEvent: + commandName: listIndexes + - *getMoreStarted + - *getMoreSucceeded + - client: *client0 + eventType: cmap + events: + # Events for first createIndexes. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for second createIndexes. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for listIndexes and getMore. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: change streams pin to a connection + operations: + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + saveResultAsEntity: &changeStream0 changeStream0 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - name: close + object: *changeStream0 + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: aggregate + - commandSucceededEvent: + commandName: aggregate + - commandStartedEvent: + commandName: killCursors + - commandSucceededEvent: + commandName: killCursors + - client: *client0 + eventType: cmap + events: + # Events for creating the change stream. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for closing the change stream. + - connectionCheckedInEvent: {} diff --git a/test/spec/load-balancers/event-monitoring.json b/test/spec/load-balancers/event-monitoring.json new file mode 100644 index 00000000000..938c70bf388 --- /dev/null +++ b/test/spec/load-balancers/event-monitoring.json @@ -0,0 +1,184 @@ +{ + "description": "monitoring events include correct fields", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "uriOptions": { + "retryReads": false + }, + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0", + "collectionName": "coll0", + "documents": [] + } + ], + "tests": [ + { + "description": "command started and succeeded events include serviceId", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert", + "hasServiceId": true + } + }, + { + "commandSucceededEvent": { + "commandName": "insert", + "hasServiceId": true + } + } + ] + } + ] + }, + { + "description": "command failed events include serviceId", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "$or": true + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "find", + "hasServiceId": true + } + }, + { + "commandFailedEvent": { + "commandName": "find", + "hasServiceId": true + } + } + ] + } + ] + }, + { + "description": "poolClearedEvent events include serviceId", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "closeConnection": true + } + } + } + }, + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "find", + "hasServiceId": true + } + }, + { + "commandFailedEvent": { + "commandName": "find", + "hasServiceId": true + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClearedEvent": { + "hasServiceId": true + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/event-monitoring.yml b/test/spec/load-balancers/event-monitoring.yml new file mode 100644 index 00000000000..52be457f68e --- /dev/null +++ b/test/spec/load-balancers/event-monitoring.yml @@ -0,0 +1,99 @@ +description: monitoring events include correct fields + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + uriOptions: + retryReads: false + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - poolClearedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0 + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: [] + +tests: + - description: command started and succeeded events include serviceId + operations: + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: insert + hasServiceId: true + - commandSucceededEvent: + commandName: insert + hasServiceId: true + + - description: command failed events include serviceId + operations: + - name: find + object: *collection0 + arguments: + filter: { $or: true } + expectError: + isError: true + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: find + hasServiceId: true + - commandFailedEvent: + commandName: find + hasServiceId: true + + - description: poolClearedEvent events include serviceId + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [find] + closeConnection: true + - name: find + object: *collection0 + arguments: + filter: {} + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: find + hasServiceId: true + - commandFailedEvent: + commandName: find + hasServiceId: true + - client: *client0 + eventType: cmap + events: + - poolClearedEvent: + hasServiceId: true diff --git a/test/spec/load-balancers/lb-connection-establishment.json b/test/spec/load-balancers/lb-connection-establishment.json new file mode 100644 index 00000000000..0eaadf30c20 --- /dev/null +++ b/test/spec/load-balancers/lb-connection-establishment.json @@ -0,0 +1,58 @@ +{ + "description": "connection establishment for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "uriOptions": { + "loadBalanced": false + }, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0" + } + } + ], + "tests": [ + { + "description": "operations against load balancers fail if URI contains loadBalanced=false", + "skipReason": "servers have not implemented LB support yet so they will not fail the connection handshake in this case", + "operations": [ + { + "name": "runCommand", + "object": "database0", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/lb-connection-establishment.yml b/test/spec/load-balancers/lb-connection-establishment.yml new file mode 100644 index 00000000000..46e5d781f3e --- /dev/null +++ b/test/spec/load-balancers/lb-connection-establishment.yml @@ -0,0 +1,36 @@ +description: connection establishment for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + uriOptions: + # Explicitly set loadBalanced to false to override the option from the global URI. + loadBalanced: false + observeEvents: + - commandStartedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0 + +tests: + - description: operations against load balancers fail if URI contains loadBalanced=false + skipReason: servers have not implemented LB support yet so they will not fail the connection handshake in this case + operations: + - name: runCommand + object: *database0 + arguments: + commandName: ping + command: { ping: 1 } + expectError: + isClientError: false + expectEvents: + # No events should be published because the server fails the connection handshake, so the "ping" command is never + # sent. + - client: *client0 + events: [] diff --git a/test/spec/load-balancers/non-lb-connection-establishment.json b/test/spec/load-balancers/non-lb-connection-establishment.json new file mode 100644 index 00000000000..6aaa7bdf98b --- /dev/null +++ b/test/spec/load-balancers/non-lb-connection-establishment.json @@ -0,0 +1,92 @@ +{ + "description": "connection establishment if loadBalanced is specified for non-load balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "single", + "sharded" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "lbTrueClient", + "useMultipleMongoses": false, + "uriOptions": { + "loadBalanced": true + } + } + }, + { + "database": { + "id": "lbTrueDatabase", + "client": "lbTrueClient", + "databaseName": "lbTrueDb" + } + }, + { + "client": { + "id": "lbFalseClient", + "uriOptions": { + "loadBalanced": false + } + } + }, + { + "database": { + "id": "lbFalseDatabase", + "client": "lbFalseClient", + "databaseName": "lbFalseDb" + } + } + ], + "_yamlAnchors": { + "runCommandArguments": [ + { + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + } + } + ] + }, + "tests": [ + { + "description": "operations against non-load balanced clusters fail if URI contains loadBalanced=true", + "operations": [ + { + "name": "runCommand", + "object": "lbTrueDatabase", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectError": { + "errorContains": "Driver attempted to initialize in load balancing mode, but the server does not support this mode" + } + } + ] + }, + { + "description": "operations against non-load balanced clusters succeed if URI contains loadBalanced=false", + "operations": [ + { + "name": "runCommand", + "object": "lbFalseDatabase", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + } + } + ] + } + ] +} diff --git a/test/spec/load-balancers/non-lb-connection-establishment.yml b/test/spec/load-balancers/non-lb-connection-establishment.yml new file mode 100644 index 00000000000..e805549ac0d --- /dev/null +++ b/test/spec/load-balancers/non-lb-connection-establishment.yml @@ -0,0 +1,56 @@ +description: connection establishment if loadBalanced is specified for non-load balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + # Don't run on replica sets because the URI used to configure the clients will contain multiple hosts and the + # replicaSet option, which will cause an error when constructing the lbTrueClient entity. + - topologies: [ single, sharded ] + +createEntities: + - client: + id: &lbTrueClient lbTrueClient + # Restrict to a single mongos to ensure there are not multiple hosts in the URI, which would conflict with + # loadBalanced=true. + useMultipleMongoses: false + uriOptions: + loadBalanced: true + - database: + id: &lbTrueDatabase lbTrueDatabase + client: *lbTrueClient + databaseName: &lbTrueDatabaseName lbTrueDb + - client: + id: &lbFalseClient lbFalseClient + uriOptions: + loadBalanced: false + - database: + id: &lbFalseDatabase lbFalseDatabase + client: *lbFalseClient + databaseName: &lbFalseDatabaseName lbFalseDb + +_yamlAnchors: + runCommandArguments: + - &pingArguments + arguments: + commandName: ping + command: { ping: 1 } + +tests: + # These tests assert that drivers behave correctly if loadBalanced=true/false for non-load balanced clusters. Existing + # spec tests should cover the case where loadBalanced is unset. + + # If the server is not configured to be behind a load balancer and the URI contains loadBalanced=true, the driver + # should error during the connection handshake because the server's hello response does not contain a serviceId field. + - description: operations against non-load balanced clusters fail if URI contains loadBalanced=true + operations: + - name: runCommand + object: *lbTrueDatabase + <<: *pingArguments + expectError: + errorContains: Driver attempted to initialize in load balancing mode, but the server does not support this mode + + - description: operations against non-load balanced clusters succeed if URI contains loadBalanced=false + operations: + - name: runCommand + object: *lbFalseDatabase + <<: *pingArguments diff --git a/test/spec/load-balancers/sdam-error-handling.json b/test/spec/load-balancers/sdam-error-handling.json new file mode 100644 index 00000000000..63aabc04dba --- /dev/null +++ b/test/spec/load-balancers/sdam-error-handling.json @@ -0,0 +1,508 @@ +{ + "description": "state change errors are correctly handled", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "_yamlAnchors": { + "observedEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + }, + "createEntities": [ + { + "client": { + "id": "failPointClient", + "useMultipleMongoses": false + } + }, + { + "client": { + "id": "singleClient", + "useMultipleMongoses": false, + "uriOptions": { + "appname": "lbSDAMErrorTestClient", + "retryWrites": false + }, + "observeEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "singleDB", + "client": "singleClient", + "databaseName": "singleDB" + } + }, + { + "collection": { + "id": "singleColl", + "database": "singleDB", + "collectionName": "singleColl" + } + }, + { + "client": { + "id": "multiClient", + "useMultipleMongoses": true, + "uriOptions": { + "retryWrites": false + }, + "observeEvents": [ + "connectionCreatedEvent", + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent", + "connectionCheckedInEvent", + "connectionClosedEvent", + "poolClearedEvent" + ] + } + }, + { + "database": { + "id": "multiDB", + "client": "multiClient", + "databaseName": "multiDB" + } + }, + { + "collection": { + "id": "multiColl", + "database": "multiDB", + "collectionName": "multiColl" + } + } + ], + "initialData": [ + { + "collectionName": "singleColl", + "databaseName": "singleDB", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + }, + { + "collectionName": "multiColl", + "databaseName": "multiDB", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "only connections for a specific serviceId are closed when pools are cleared", + "operations": [ + { + "name": "createFindCursor", + "object": "multiColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "createFindCursor", + "object": "multiColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor1" + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "close", + "object": "cursor1" + }, + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "multiClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 11600 + } + } + } + }, + { + "name": "insertOne", + "object": "multiColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "errorCode": 11600 + } + }, + { + "name": "insertOne", + "object": "multiColl", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "multiClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "stale" + } + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "errors during the initial connection hello are ignore", + "runOnRequirements": [ + { + "minServerVersion": "4.9" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "isMaster" + ], + "closeConnection": true, + "appName": "lbSDAMErrorTestClient" + } + } + } + }, + { + "name": "insertOne", + "object": "singleColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionCheckOutFailedEvent": { + "reason": "connectionError" + } + } + ] + } + ] + }, + { + "description": "errors during authentication are processed", + "runOnRequirements": [ + { + "auth": true + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "saslContinue" + ], + "closeConnection": true, + "appName": "lbSDAMErrorTestClient" + } + } + } + }, + { + "name": "insertOne", + "object": "singleColl", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionCheckOutFailedEvent": { + "reason": "connectionError" + } + } + ] + } + ] + }, + { + "description": "stale errors are ignored", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "failPointClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "getMore" + ], + "closeConnection": true + } + } + } + }, + { + "name": "createFindCursor", + "object": "singleColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "createFindCursor", + "object": "singleColl", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectError": { + "isClientError": true + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor1", + "expectError": { + "isClientError": true + } + }, + { + "name": "close", + "object": "cursor1" + } + ], + "expectEvents": [ + { + "client": "singleClient", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCreatedEvent": {} + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "poolClearedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/sdam-error-handling.yml b/test/spec/load-balancers/sdam-error-handling.yml new file mode 100644 index 00000000000..9ed1b226fb8 --- /dev/null +++ b/test/spec/load-balancers/sdam-error-handling.yml @@ -0,0 +1,270 @@ +description: state change errors are correctly handled + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +_yamlAnchors: + observedEvents: &observedEvents + - connectionCreatedEvent + - connectionReadyEvent + - connectionCheckedOutEvent + - connectionCheckOutFailedEvent + - connectionCheckedInEvent + - connectionClosedEvent + - poolClearedEvent + +createEntities: + - client: + id: &failPointClient failPointClient + useMultipleMongoses: false + - client: + id: &singleClient singleClient + useMultipleMongoses: false + uriOptions: + appname: &singleClientAppName lbSDAMErrorTestClient + retryWrites: false + observeEvents: *observedEvents + - database: + id: &singleDB singleDB + client: *singleClient + databaseName: &singleDBName singleDB + - collection: + id: &singleColl singleColl + database: *singleDB + collectionName: &singleCollName singleColl + - client: + id: &multiClient multiClient + useMultipleMongoses: true + uriOptions: + retryWrites: false + observeEvents: *observedEvents + - database: + id: &multiDB multiDB + client: *multiClient + databaseName: &multiDBName multiDB + - collection: + id: &multiColl multiColl + database: *multiDB + collectionName: &multiCollName multiColl + +initialData: + - collectionName: *singleCollName + databaseName: *singleDBName + documents: + - _id: 1 + - _id: 2 + - _id: 3 + - collectionName: *multiCollName + databaseName: *multiDBName + documents: + - _id: 1 + - _id: 2 + - _id: 3 + +tests: + - description: only connections for a specific serviceId are closed when pools are cleared + operations: + # Create two cursors to force two connections. + - name: createFindCursor + object: *multiColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: createFindCursor + object: *multiColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor1 cursor1 + # Close both cursors to return the connections to the pool. + - name: close + object: *cursor0 + - name: close + object: *cursor1 + # Fail an operation with a state change error. + - name: failPoint + object: testRunner + arguments: + client: *multiClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [insert] + errorCode: &errorCode 11600 # InterruptedAtShutdown + - name: insertOne + object: *multiColl + arguments: + document: { x: 1 } + expectError: + errorCode: *errorCode + # Do another operation to ensure the relevant connection has been closed. + - name: insertOne + object: *multiColl + arguments: + document: { x: 1 } + expectEvents: + - client: *multiClient + eventType: cmap + events: + # Create cursors. + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Close cursors. + - connectionCheckedInEvent: {} + - connectionCheckedInEvent: {} + # Set failpoint. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # First insertOne. + - connectionCheckedOutEvent: {} + - poolClearedEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: stale + # Second insertOne. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + # This test uses singleClient to ensure that connection attempts are routed + # to the same mongos on which the failpoint is set. + - description: errors during the initial connection hello are ignore + runOnRequirements: + # Server version 4.9+ is needed to set a fail point on the initial + # connection handshake with the appName filter due to SERVER-49336. + - minServerVersion: '4.9' + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [isMaster] + closeConnection: true + appName: *singleClientAppName + - name: insertOne + object: *singleColl + arguments: + document: { x: 1 } + expectError: + isClientError: true + expectEvents: + - client: *singleClient + eventType: cmap + events: + - connectionCreatedEvent: {} + - connectionClosedEvent: + reason: error + - connectionCheckOutFailedEvent: + reason: connectionError + + - description: errors during authentication are processed + runOnRequirements: + - auth: true + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [saslContinue] + closeConnection: true + appName: *singleClientAppName + - name: insertOne + object: *singleColl + arguments: + document: { x: 1 } + expectError: + isClientError: true + expectEvents: + - client: *singleClient + eventType: cmap + events: + - connectionCreatedEvent: {} + - poolClearedEvent: {} + - connectionClosedEvent: + reason: error + - connectionCheckOutFailedEvent: + reason: connectionError + + - description: stale errors are ignored + operations: + - name: failPoint + object: testRunner + arguments: + client: *failPointClient + failPoint: + configureFailPoint: failCommand + mode: { times: 2 } + data: + failCommands: [getMore] + closeConnection: true + # Force two connections to be checked out from the pool. + - name: createFindCursor + object: *singleColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: createFindCursor + object: *singleColl + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor1 cursor1 + # Iterate cursor0 three times to force a network error. + - name: iterateUntilDocumentOrError + object: *cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectError: + isClientError: true + - name: close + object: *cursor0 + # Iterate cursor1 three times to force a network error. + - name: iterateUntilDocumentOrError + object: *cursor1 + - name: iterateUntilDocumentOrError + object: *cursor1 + - name: iterateUntilDocumentOrError + object: *cursor1 + expectError: + isClientError: true + - name: close + object: *cursor1 + expectEvents: + - client: *singleClient + eventType: cmap + events: + # Events for creating both cursors. + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCreatedEvent: {} + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for iterating and closing the first cursor. The failed + # getMore should cause a poolClearedEvent to be published. + - poolClearedEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: {} + # Events for iterating and closing the second cursor. The failed + # getMore should not clear the pool because the connection's + # generation number is stale. + - connectionCheckedInEvent: {} + - connectionClosedEvent: {} diff --git a/test/spec/load-balancers/server-selection.json b/test/spec/load-balancers/server-selection.json new file mode 100644 index 00000000000..00c7e4c95b4 --- /dev/null +++ b/test/spec/load-balancers/server-selection.json @@ -0,0 +1,82 @@ +{ + "description": "server selection for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0", + "collectionOptions": { + "readPreference": { + "mode": "secondaryPreferred" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "$readPreference is sent for load-balanced clusters", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "$readPreference": { + "mode": "secondaryPreferred" + } + }, + "commandName": "find", + "databaseName": "database0Name" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/server-selection.yml b/test/spec/load-balancers/server-selection.yml new file mode 100644 index 00000000000..5c5c9a9a126 --- /dev/null +++ b/test/spec/load-balancers/server-selection.yml @@ -0,0 +1,50 @@ +description: server selection for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + collectionOptions: + readPreference: + # Use secondaryPreferred to ensure that operations can succeed even if the shards are only comprised of one + # server. + mode: &readPrefMode secondaryPreferred + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: $readPreference is sent for load-balanced clusters + operations: + - name: find + object: *collection0 + arguments: + filter: {} + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + $readPreference: + mode: *readPrefMode + commandName: find + databaseName: *database0Name diff --git a/test/spec/load-balancers/transactions.json b/test/spec/load-balancers/transactions.json new file mode 100644 index 00000000000..add24538482 --- /dev/null +++ b/test/spec/load-balancers/transactions.json @@ -0,0 +1,1606 @@ +{ + "description": "transactions are correctly pinned to connections for load-balanced clusters", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "connectionReadyEvent", + "connectionClosedEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "_yamlAnchors": { + "documents": [ + { + "_id": 4 + } + ] + }, + "tests": [ + { + "description": "sessions are reused in LB mode", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "assertSameLsidOnLastTwoCommands", + "object": "testRunner", + "arguments": { + "client": "client0" + } + } + ] + }, + { + "description": "all operations go to the same mongos", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "transaction can be committed multiple times", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is not released after a non-transient CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "errorCode": 51, + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is not released after a non-transient commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "expectError": { + "errorCode": 51, + "errorLabelsOmit": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a non-transient abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 51 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "errorCode": 24, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network CRUD error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + }, + "expectError": { + "isClientError": true, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "expectError": { + "errorCode": 24, + "errorLabelsContain": [ + "TransientTransactionError" + ] + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network commit error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "commitTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0", + "ignoreResultAndError": true + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient non-network abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "errorCode": 24 + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released after a transient network abort error", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "abortTransaction" + ], + "closeConnection": true + } + } + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionClosedEvent": { + "reason": "error" + } + }, + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is released on successful abort", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is returned when a new transaction is started", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "commitTransaction", + "object": "session0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + } + ] + } + ] + }, + { + "description": "pinned connection is returned when a non-transaction operation uses the session", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "commitTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "commitTransaction" + } + }, + { + "commandStartedEvent": { + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + }, + { + "description": "a connection can be shared by a transaction and a cursor", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2, + "session": "session0" + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "close", + "object": "cursor0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + }, + { + "name": "abortTransaction", + "object": "session0" + }, + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": "insert" + } + }, + { + "commandStartedEvent": { + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "commandName": "killCursors" + } + }, + { + "commandStartedEvent": { + "commandName": "abortTransaction" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/transactions.yml b/test/spec/load-balancers/transactions.yml new file mode 100644 index 00000000000..90f9d4a09ed --- /dev/null +++ b/test/spec/load-balancers/transactions.yml @@ -0,0 +1,592 @@ +description: transactions are correctly pinned to connections for load-balanced clusters + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + # Do not observe commandSucceededEvent or commandFailedEvent because we cannot guarantee success or failure of + # commands like commitTransaction and abortTransaction in a multi-mongos load-balanced setup. + - commandStartedEvent + - connectionReadyEvent + - connectionClosedEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - session: + id: &session0 session0 + client: *client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1 } + - { _id: 2 } + - { _id: 3 } + +_yamlAnchors: + documents: + - &insertDocument + _id: 4 + +tests: + - description: sessions are reused in LB mode + operations: + - &nonTransactionalInsert + name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + - *nonTransactionalInsert + - name: assertSameLsidOnLastTwoCommands + object: testRunner + arguments: + client: *client0 + + - description: all operations go to the same mongos + operations: + - &startTransaction + name: startTransaction + object: *session0 + - &transactionalInsert + name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + - &assertConnectionPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *transactionalInsert + - *assertConnectionPinned + - &commitTransaction + name: commitTransaction + object: *session0 + expectEvents: + - client: *client0 + events: + - &insertStarted + commandStartedEvent: + commandName: insert + - *insertStarted + - *insertStarted + - *insertStarted + - *insertStarted + - *insertStarted + - &commitStarted + commandStartedEvent: + commandName: commitTransaction + - client: *client0 + eventType: cmap + events: + # The connection is never checked back in. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + + - description: transaction can be committed multiple times + operations: + - *startTransaction + - *transactionalInsert + - *assertConnectionPinned + - *commitTransaction + - *assertConnectionPinned + - *commitTransaction + - *commitTransaction + - *commitTransaction + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *commitStarted + - *commitStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + + - description: pinned connection is not released after a non-transient CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + errorCode: &nonTransientErrorCode 51 # ManualInterventionRequired + - *startTransaction + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + expectError: &nonTransientExpectedError + errorCode: *nonTransientErrorCode + errorLabelsOmit: [ TransientTransactionError ] + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert. + - connectionCheckedOutEvent: {} + + - description: pinned connection is not released after a non-transient commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + errorCode: *nonTransientErrorCode + - *startTransaction + - *transactionalInsert + - name: commitTransaction + object: *session0 + expectError: *nonTransientExpectedError + - *assertConnectionPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert and commit. + - connectionCheckedOutEvent: {} + + # Errors during abort are different than errors during commit and CRUD operations because the pinned connection is + # always released after abort. + - description: pinned connection is released after a non-transient abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + errorCode: &nonTransientErrorCode 51 # ManualInterventionRequired + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - &assertConnectionNotPinned + name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 + expectEvents: + - client: *client0 + events: + - *insertStarted + - &abortStarted + commandStartedEvent: + commandName: abortTransaction + - client: *client0 + eventType: cmap + events: + # Events for setting the fail point. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the transactional insert and abort. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + errorCode: &transientErrorCode 24 # LockTimeout + - *startTransaction + - <<: *transactionalInsert + expectError: &transientExpectedServerError + errorCode: *transientErrorCode + errorLabelsContain: [ TransientTransactionError ] + - *assertConnectionNotPinned + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for abortTransction. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network CRUD error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ insert ] + closeConnection: true + - *startTransaction + - <<: *transactionalInsert + expectError: &transientExpectedNetworkError + isClientError: true + errorLabelsContain: [ TransientTransactionError ] + - *assertConnectionNotPinned + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for abortTransaction + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + errorCode: *transientErrorCode + - *startTransaction + - *transactionalInsert + - <<: *commitTransaction + expectError: *transientExpectedServerError + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for commitTransaction. + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network commit error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ commitTransaction ] + closeConnection: true + - *startTransaction + - *transactionalInsert + - <<: *commitTransaction + # Ignore the result and error because the operation might fail if it targets a new mongos that isn't aware of + # the transaction or the server-side reaper thread closes the transaction first. We only want to assert that + # the operation is retried, which is done via monitoring expectations, so the exact result/error is not + # necessary. + ignoreResultAndError: true + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + # The commit will be automatically retried. + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for the first commitTransaction. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for the commitTransaction retry. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient non-network abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + errorCode: *transientErrorCode + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for abortTransaction. + - connectionCheckedInEvent: {} + + - description: pinned connection is released after a transient network abort error + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ abortTransaction ] + closeConnection: true + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + # The abort will be automatically retried. + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for setting the failpoint. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + # Events for the insert. + - connectionCheckedOutEvent: {} + # Events for the first abortTransaction. + - connectionCheckedInEvent: {} + - connectionClosedEvent: + reason: error + # Events for the abortTransaction retry. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is released on successful abort + operations: + - *startTransaction + - *transactionalInsert + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *abortStarted + - client: *client0 + eventType: cmap + events: + # The insert will create and pin a connection. The abort will use it and then unpin. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: pinned connection is returned when a new transaction is started + operations: + - *startTransaction + - *transactionalInsert + - *commitTransaction + - *assertConnectionPinned + - *startTransaction + - *assertConnectionNotPinned # startTransaction will unpin the connection. + - *transactionalInsert + - *assertConnectionPinned # The first operation in the new transaction will pin the connection again. + - *commitTransaction + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *insertStarted + - *commitStarted + - client: *client0 + eventType: cmap + events: + # Events for the first insert and commit. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for startTransaction. + - connectionCheckedInEvent: {} + # Events for the second insert and commit. + - connectionCheckedOutEvent: {} + + - description: pinned connection is returned when a non-transaction operation uses the session + operations: + - *startTransaction + - *transactionalInsert + - *commitTransaction + - *assertConnectionPinned + - *transactionalInsert + # The insert is a non-transactional operation that uses the session, so it unpins the connection. + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - *commitStarted + - *insertStarted + - client: *client0 + eventType: cmap + events: + # Events for the first insert and commit. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for the second insert. + - connectionCheckedInEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} + + - description: a connection can be shared by a transaction and a cursor + operations: + - *startTransaction + - *transactionalInsert + - *assertConnectionPinned + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + session: *session0 + saveResultAsEntity: &cursor0 cursor0 + - *assertConnectionPinned + - name: close + object: *cursor0 + - *assertConnectionPinned + # Abort the transaction to ensure that the connection is unpinned. + - name: abortTransaction + object: *session0 + - *assertConnectionNotPinned + expectEvents: + - client: *client0 + events: + - *insertStarted + - commandStartedEvent: + commandName: find + - commandStartedEvent: + commandName: killCursors + - *abortStarted + - client: *client0 + eventType: cmap + events: + # Events for the insert, find, and killCursors. + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + # Events for abortTransaction. + - connectionCheckedInEvent: {} diff --git a/test/spec/load-balancers/wait-queue-timeouts.json b/test/spec/load-balancers/wait-queue-timeouts.json new file mode 100644 index 00000000000..3dc6e46cffe --- /dev/null +++ b/test/spec/load-balancers/wait-queue-timeouts.json @@ -0,0 +1,153 @@ +{ + "description": "wait queue timeout errors include details about checked out connections", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "topologies": [ + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "uriOptions": { + "maxPoolSize": 1, + "waitQueueTimeoutMS": 50 + }, + "observeEvents": [ + "connectionCheckedOutEvent", + "connectionCheckOutFailedEvent" + ] + } + }, + { + "session": { + "id": "session0", + "client": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + } + ] + } + ], + "tests": [ + { + "description": "wait queue timeout errors include cursor statistics", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true, + "errorContains": "maxPoolSize: 1, connections in use by cursors: 1, connections in use by transactions: 0, connections in use by other operations: 0" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckOutFailedEvent": {} + } + ] + } + ] + }, + { + "description": "wait queue timeout errors include transaction statistics", + "operations": [ + { + "name": "startTransaction", + "object": "session0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + }, + "session": "session0" + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + }, + "expectError": { + "isClientError": true, + "errorContains": "maxPoolSize: 1, connections in use by cursors: 0, connections in use by transactions: 1, connections in use by other operations: 0" + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckOutFailedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/load-balancers/wait-queue-timeouts.yml b/test/spec/load-balancers/wait-queue-timeouts.yml new file mode 100644 index 00000000000..9d8c935feaa --- /dev/null +++ b/test/spec/load-balancers/wait-queue-timeouts.yml @@ -0,0 +1,82 @@ +description: wait queue timeout errors include details about checked out connections + +schemaVersion: '1.3' + +runOnRequirements: + - topologies: [ load-balanced ] + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + uriOptions: + maxPoolSize: 1 + waitQueueTimeoutMS: 50 + observeEvents: + - connectionCheckedOutEvent + - connectionCheckOutFailedEvent + - session: + id: &session0 session0 + client: *client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - _id: 1 + - _id: 2 + - _id: 3 + +tests: + - description: wait queue timeout errors include cursor statistics + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectError: + isClientError: true + errorContains: 'maxPoolSize: 1, connections in use by cursors: 1, connections in use by transactions: 0, connections in use by other operations: 0' + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionCheckedOutEvent: {} + - connectionCheckOutFailedEvent: {} + + - description: wait queue timeout errors include transaction statistics + operations: + - name: startTransaction + object: *session0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + session: *session0 + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectError: + isClientError: true + errorContains: 'maxPoolSize: 1, connections in use by cursors: 0, connections in use by transactions: 1, connections in use by other operations: 0' + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionCheckedOutEvent: {} + - connectionCheckOutFailedEvent: {} diff --git a/test/spec/retryable-reads/README.rst b/test/spec/retryable-reads/README.rst index ffb842c3031..0f56d23b0d6 100644 --- a/test/spec/retryable-reads/README.rst +++ b/test/spec/retryable-reads/README.rst @@ -74,9 +74,10 @@ Each YAML file has the following keys: version. - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - and "sharded". If this field is omitted, the default is all topologies (i.e. - ``["single", "replicaset", "sharded"]``). + tests can be run successfully. Valid topologies are "single", + "replicaset", "sharded", and "load-balanced". If this field is omitted, + the default is all topologies (i.e. ``["single", "replicaset", "sharded", + "load-balanced"]``). - ``database_name`` and ``collection_name``: Optional. The database and collection to use for testing. @@ -150,12 +151,14 @@ data. Speeding Up Tests ----------------- -Drivers may benefit reducing `minHeartbeatFrequencyMS`_ in order to speed up -tests. Python was able to decrease the run time of the tests greatly by lowering -the SDAM's ``minHeartbeatFrequencyMS`` from 500ms to 50ms, thus decreasing the -waiting time after a "not master" error: +Drivers can greatly reduce the execution time of tests by setting `heartbeatFrequencyMS`_ +and `minHeartbeatFrequencyMS`_ (internally) to a small value (e.g. 5ms), below what +is normally permitted in the SDAM spec. If a test specifies an explicit value for +heartbeatFrequencyMS (e.g. client or URI options), drivers MUST use that value. + +.. _minHeartbeatFrequencyMS: ../../server-discovery-and-monitoring/server-discovery-and-monitoring.rst#minheartbeatfrequencyms +.. _heartbeatFrequencyMS: ../../server-discovery-and-monitoring/server-discovery-and-monitoring.rst#heartbeatfrequencyms -.. _minHeartbeatFrequencyMS: https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#minheartbeatfrequencyms Optional Enumeration Commands ============================= @@ -171,3 +174,7 @@ Changelog now expressed within ``runOn`` elements. Add test-level ``useMultipleMongoses`` field. + +:2020-09-16: Suggest lowering heartbeatFrequencyMS in addition to minHeartbeatFrequencyMS. + +:2021-04-23: Add ``load-balanced`` to test topology requirements. diff --git a/test/spec/retryable-reads/aggregate-serverErrors.json b/test/spec/retryable-reads/aggregate-serverErrors.json index 04208bc95b8..67636d5b7dc 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.json +++ b/test/spec/retryable-reads/aggregate-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/aggregate-serverErrors.yml b/test/spec/retryable-reads/aggregate-serverErrors.yml index 5d0619646b0..b64b7b3adc4 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.yml +++ b/test/spec/retryable-reads/aggregate-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/aggregate.json b/test/spec/retryable-reads/aggregate.json index 30a6e05e695..f23d5c67939 100644 --- a/test/spec/retryable-reads/aggregate.json +++ b/test/spec/retryable-reads/aggregate.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/aggregate.yml b/test/spec/retryable-reads/aggregate.yml index df7cc8e2c88..c8443e3fbf3 100644 --- a/test/spec/retryable-reads/aggregate.yml +++ b/test/spec/retryable-reads/aggregate.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json index cf6c230ec8f..17bc53fd4bd 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml index 50ca49dff7e..61fe2358a1c 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-client.watch.json b/test/spec/retryable-reads/changeStreams-client.watch.json index 9a2ccad0950..9a07053f843 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.json +++ b/test/spec/retryable-reads/changeStreams-client.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-client.watch.yml b/test/spec/retryable-reads/changeStreams-client.watch.yml index 865619e721c..5550bfa100e 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json index eb7df1e2643..5b405e3feba 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml index 3926db122c6..37ad0ae00d0 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.json b/test/spec/retryable-reads/changeStreams-db.coll.watch.json index 3408c842362..5e69d9da260 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml index bffa40b5bdf..50258cca2ec 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json index e070f56a01b..56fa6629010 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml index f8e6de76749..7ee9df0743b 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch.json b/test/spec/retryable-reads/changeStreams-db.watch.json index bec09c49b76..1777e1832e0 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.watch.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/changeStreams-db.watch.yml b/test/spec/retryable-reads/changeStreams-db.watch.yml index b180114618b..e46c5141690 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count-serverErrors.json b/test/spec/retryable-reads/count-serverErrors.json index 839680fe59f..565323640e4 100644 --- a/test/spec/retryable-reads/count-serverErrors.json +++ b/test/spec/retryable-reads/count-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/count-serverErrors.yml b/test/spec/retryable-reads/count-serverErrors.yml index ff40f9d0736..4f7f5c9c940 100644 --- a/test/spec/retryable-reads/count-serverErrors.yml +++ b/test/spec/retryable-reads/count-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count.json b/test/spec/retryable-reads/count.json index 0ccf4982ba6..139a5451318 100644 --- a/test/spec/retryable-reads/count.json +++ b/test/spec/retryable-reads/count.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/count.yml b/test/spec/retryable-reads/count.yml index 365905c5677..c9c3936b6b0 100644 --- a/test/spec/retryable-reads/count.yml +++ b/test/spec/retryable-reads/count.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.json b/test/spec/retryable-reads/countDocuments-serverErrors.json index f45eadfa0c2..107372ef30a 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.json +++ b/test/spec/retryable-reads/countDocuments-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.yml b/test/spec/retryable-reads/countDocuments-serverErrors.yml index 4c0d88f89ce..6d5e309cf98 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.yml +++ b/test/spec/retryable-reads/countDocuments-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/countDocuments.json b/test/spec/retryable-reads/countDocuments.json index b4ccf36684d..57a64e45b79 100644 --- a/test/spec/retryable-reads/countDocuments.json +++ b/test/spec/retryable-reads/countDocuments.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/countDocuments.yml b/test/spec/retryable-reads/countDocuments.yml index 07b3662704e..9e2565129c8 100644 --- a/test/spec/retryable-reads/countDocuments.yml +++ b/test/spec/retryable-reads/countDocuments.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/distinct-serverErrors.json b/test/spec/retryable-reads/distinct-serverErrors.json index 50fd6a55051..109231c6702 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.json +++ b/test/spec/retryable-reads/distinct-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/distinct-serverErrors.yml b/test/spec/retryable-reads/distinct-serverErrors.yml index 7232bdcb362..3de14aeb08e 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.yml +++ b/test/spec/retryable-reads/distinct-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/distinct.json b/test/spec/retryable-reads/distinct.json index b5885e27eb7..1fd415da812 100644 --- a/test/spec/retryable-reads/distinct.json +++ b/test/spec/retryable-reads/distinct.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/distinct.yml b/test/spec/retryable-reads/distinct.yml index aaca90701f1..8ca2ac83159 100644 --- a/test/spec/retryable-reads/distinct.yml +++ b/test/spec/retryable-reads/distinct.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/find-serverErrors.json b/test/spec/retryable-reads/find-serverErrors.json index 44ecf34d2fb..914b91da05a 100644 --- a/test/spec/retryable-reads/find-serverErrors.json +++ b/test/spec/retryable-reads/find-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/find-serverErrors.yml b/test/spec/retryable-reads/find-serverErrors.yml index 3a5ae17303c..17819ea8620 100644 --- a/test/spec/retryable-reads/find-serverErrors.yml +++ b/test/spec/retryable-reads/find-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/find.json b/test/spec/retryable-reads/find.json index 56479ff1d87..00d419c0da6 100644 --- a/test/spec/retryable-reads/find.json +++ b/test/spec/retryable-reads/find.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/find.yml b/test/spec/retryable-reads/find.yml index 0f985a91a86..b685c07b6af 100644 --- a/test/spec/retryable-reads/find.yml +++ b/test/spec/retryable-reads/find.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/findOne-serverErrors.json b/test/spec/retryable-reads/findOne-serverErrors.json index b8229483d24..4c0c07234ed 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.json +++ b/test/spec/retryable-reads/findOne-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/findOne-serverErrors.yml b/test/spec/retryable-reads/findOne-serverErrors.yml index a15d8511ed2..63ced439c98 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.yml +++ b/test/spec/retryable-reads/findOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/findOne.json b/test/spec/retryable-reads/findOne.json index d296a9cdb5e..b9deb73d2ab 100644 --- a/test/spec/retryable-reads/findOne.json +++ b/test/spec/retryable-reads/findOne.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/findOne.yml b/test/spec/retryable-reads/findOne.yml index ec348fedf15..911314e98e7 100644 --- a/test/spec/retryable-reads/findOne.yml +++ b/test/spec/retryable-reads/findOne.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.json b/test/spec/retryable-reads/gridfs-download-serverErrors.json index 84e50e370c4..d54928b1268 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.yml b/test/spec/retryable-reads/gridfs-download-serverErrors.yml index 11789f6e4ff..aa949a5632f 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-download.json b/test/spec/retryable-reads/gridfs-download.json index a5c5ef4d559..4d0d5a17e4d 100644 --- a/test/spec/retryable-reads/gridfs-download.json +++ b/test/spec/retryable-reads/gridfs-download.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-download.yml b/test/spec/retryable-reads/gridfs-download.yml index bd75e8f0171..a71c719d9ad 100644 --- a/test/spec/retryable-reads/gridfs-download.yml +++ b/test/spec/retryable-reads/gridfs-download.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json index de439ce4b20..1325ab89abb 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml index bea6c3baa85..a66ba9b1402 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/gridfs-downloadByName.json b/test/spec/retryable-reads/gridfs-downloadByName.json index 0634a09bff4..48f2168cfc3 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName.json +++ b/test/spec/retryable-reads/gridfs-downloadByName.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/gridfs-downloadByName.yml b/test/spec/retryable-reads/gridfs-downloadByName.yml index 98970d25aaa..e5586954f06 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" bucket_name: "fs" diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.json b/test/spec/retryable-reads/listCollectionNames-serverErrors.json index 27c13d6301c..90ccda71399 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml index cdfcc9c6d4a..889d2a5b5ce 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionNames.json b/test/spec/retryable-reads/listCollectionNames.json index 437fc36a40e..73d96a3cf7a 100644 --- a/test/spec/retryable-reads/listCollectionNames.json +++ b/test/spec/retryable-reads/listCollectionNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionNames.yml b/test/spec/retryable-reads/listCollectionNames.yml index 40886beb3bb..434adfbdd17 100644 --- a/test/spec/retryable-reads/listCollectionNames.yml +++ b/test/spec/retryable-reads/listCollectionNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json index 3922713df9c..6ca8c242fab 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml index a1c2553cbe7..97fb0778e4e 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollectionObjects.json b/test/spec/retryable-reads/listCollectionObjects.json index 1f537b743f0..1fb0f184374 100644 --- a/test/spec/retryable-reads/listCollectionObjects.json +++ b/test/spec/retryable-reads/listCollectionObjects.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollectionObjects.yml b/test/spec/retryable-reads/listCollectionObjects.yml index 9a3ca62a4d7..885c0489afe 100644 --- a/test/spec/retryable-reads/listCollectionObjects.yml +++ b/test/spec/retryable-reads/listCollectionObjects.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollections-serverErrors.json b/test/spec/retryable-reads/listCollections-serverErrors.json index 6972073b181..1938fa4ab4b 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.json +++ b/test/spec/retryable-reads/listCollections-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollections-serverErrors.yml b/test/spec/retryable-reads/listCollections-serverErrors.yml index 057264d6a03..bb35d8dbc71 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.yml +++ b/test/spec/retryable-reads/listCollections-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listCollections.json b/test/spec/retryable-reads/listCollections.json index a6b452e64f0..2427883621c 100644 --- a/test/spec/retryable-reads/listCollections.json +++ b/test/spec/retryable-reads/listCollections.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listCollections.yml b/test/spec/retryable-reads/listCollections.yml index cd8a964fe78..378ff924f45 100644 --- a/test/spec/retryable-reads/listCollections.yml +++ b/test/spec/retryable-reads/listCollections.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json index 11faf58bf04..eef8b7fe750 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml index a746762f1ec..ef777f01757 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseNames.json b/test/spec/retryable-reads/listDatabaseNames.json index b35f7ab185f..b431f570161 100644 --- a/test/spec/retryable-reads/listDatabaseNames.json +++ b/test/spec/retryable-reads/listDatabaseNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseNames.yml b/test/spec/retryable-reads/listDatabaseNames.yml index 33c8e2edfc2..13e01a48eaf 100644 --- a/test/spec/retryable-reads/listDatabaseNames.yml +++ b/test/spec/retryable-reads/listDatabaseNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json index 38082f2e28b..054d1dc8b18 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml index 57c7df1376f..f413304d31f 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabaseObjects.json b/test/spec/retryable-reads/listDatabaseObjects.json index cbd2c6763a3..267fe921cab 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.json +++ b/test/spec/retryable-reads/listDatabaseObjects.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabaseObjects.yml b/test/spec/retryable-reads/listDatabaseObjects.yml index 5bd648fe482..e4a31cfe213 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.yml +++ b/test/spec/retryable-reads/listDatabaseObjects.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.json b/test/spec/retryable-reads/listDatabases-serverErrors.json index 4047f749ffc..9da07b7f50b 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.json +++ b/test/spec/retryable-reads/listDatabases-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.yml b/test/spec/retryable-reads/listDatabases-serverErrors.yml index a49ec501385..a5ed406c847 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabases-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listDatabases.json b/test/spec/retryable-reads/listDatabases.json index 3cb8bbd083c..69ef9788f8d 100644 --- a/test/spec/retryable-reads/listDatabases.json +++ b/test/spec/retryable-reads/listDatabases.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listDatabases.yml b/test/spec/retryable-reads/listDatabases.yml index 7d8845a613e..3eaed913add 100644 --- a/test/spec/retryable-reads/listDatabases.yml +++ b/test/spec/retryable-reads/listDatabases.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.json b/test/spec/retryable-reads/listIndexNames-serverErrors.json index 1a9ba83bc69..3737e0059e1 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.json +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.yml b/test/spec/retryable-reads/listIndexNames-serverErrors.yml index e03bbed48ed..5420d01aa73 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexNames.json b/test/spec/retryable-reads/listIndexNames.json index 912c706015f..fbdb420f8ad 100644 --- a/test/spec/retryable-reads/listIndexNames.json +++ b/test/spec/retryable-reads/listIndexNames.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexNames.yml b/test/spec/retryable-reads/listIndexNames.yml index 7c78a0fda61..3a73b51e15a 100644 --- a/test/spec/retryable-reads/listIndexNames.yml +++ b/test/spec/retryable-reads/listIndexNames.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.json b/test/spec/retryable-reads/listIndexes-serverErrors.json index 16b61d535d6..6ac0b0a3f99 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.json +++ b/test/spec/retryable-reads/listIndexes-serverErrors.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.yml b/test/spec/retryable-reads/listIndexes-serverErrors.yml index 39222232003..7e203ae1d5c 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexes-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/listIndexes.json b/test/spec/retryable-reads/listIndexes.json index f460ea7684f..5cb620ae45a 100644 --- a/test/spec/retryable-reads/listIndexes.json +++ b/test/spec/retryable-reads/listIndexes.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/listIndexes.yml b/test/spec/retryable-reads/listIndexes.yml index 95e823b666a..84ba7242a38 100644 --- a/test/spec/retryable-reads/listIndexes.yml +++ b/test/spec/retryable-reads/listIndexes.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/mapReduce.json b/test/spec/retryable-reads/mapReduce.json index 9dc7a56f3c2..e76aa76cbb9 100644 --- a/test/spec/retryable-reads/mapReduce.json +++ b/test/spec/retryable-reads/mapReduce.json @@ -10,7 +10,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-reads/mapReduce.yml b/test/spec/retryable-reads/mapReduce.yml index a69e7ef61ce..968d3d50371 100644 --- a/test/spec/retryable-reads/mapReduce.yml +++ b/test/spec/retryable-reads/mapReduce.yml @@ -4,7 +4,7 @@ runOn: topology: ["single", "replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-writes/README.rst b/test/spec/retryable-writes/README.rst index 2f431ba39d4..88d8e52fc88 100644 --- a/test/spec/retryable-writes/README.rst +++ b/test/spec/retryable-writes/README.rst @@ -91,6 +91,11 @@ disabled like so:: mode: "off" }); +Speeding Up Tests +================= + +See `Speeding Up Tests <../../retryable-reads/tests/README.rst#speeding-up-tests>`_ in the retryable reads spec tests. + Use as Integration Tests ======================== @@ -154,9 +159,10 @@ Each YAML file has the following keys: version. - ``topology`` (optional): An array of server topologies against which the - tests can be run successfully. Valid topologies are "single", "replicaset", - and "sharded". If this field is omitted, the default is all topologies (i.e. - ``["single", "replicaset", "sharded"]``). + tests can be run successfully. Valid topologies are "single", + "replicaset", "sharded", and "load-balanced". If this field is omitted, + the default is all topologies (i.e. ``["single", "replicaset", "sharded", + "load-balanced"]``). - ``data``: The data that should exist in the collection under test before each test run. @@ -325,6 +331,8 @@ and sharded clusters. Changelog ========= +:2021-04-23: Add ``load-balanced`` to test topology requirements. + :2019-10-21: Add ``errorLabelsContain`` and ``errorLabelsContain`` fields to ``result`` :2019-08-07: Add Prose Tests section diff --git a/test/spec/retryable-writes/bulkWrite-errorLabels.json b/test/spec/retryable-writes/bulkWrite-errorLabels.json index 94ea3ea989f..66c3ecb336a 100644 --- a/test/spec/retryable-writes/bulkWrite-errorLabels.json +++ b/test/spec/retryable-writes/bulkWrite-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/bulkWrite-errorLabels.yml b/test/spec/retryable-writes/bulkWrite-errorLabels.yml index 60fc18d73f7..fb9d7e47e06 100644 --- a/test/spec/retryable-writes/bulkWrite-errorLabels.yml +++ b/test/spec/retryable-writes/bulkWrite-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/bulkWrite-serverErrors.json b/test/spec/retryable-writes/bulkWrite-serverErrors.json index d9561d568c0..9d792ceafbb 100644 --- a/test/spec/retryable-writes/bulkWrite-serverErrors.json +++ b/test/spec/retryable-writes/bulkWrite-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/bulkWrite-serverErrors.yml b/test/spec/retryable-writes/bulkWrite-serverErrors.yml index e2f3a601dcb..0235a8a1ce8 100644 --- a/test/spec/retryable-writes/bulkWrite-serverErrors.yml +++ b/test/spec/retryable-writes/bulkWrite-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteMany.json b/test/spec/retryable-writes/deleteMany.json index 642ad11fb47..faa21c44f1e 100644 --- a/test/spec/retryable-writes/deleteMany.json +++ b/test/spec/retryable-writes/deleteMany.json @@ -4,7 +4,8 @@ "minServerVersion": "3.6", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteMany.yml b/test/spec/retryable-writes/deleteMany.yml index c206fa56bb5..4743953fffe 100644 --- a/test/spec/retryable-writes/deleteMany.yml +++ b/test/spec/retryable-writes/deleteMany.yml @@ -1,7 +1,7 @@ runOn: - minServerVersion: "3.6" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteOne-errorLabels.json b/test/spec/retryable-writes/deleteOne-errorLabels.json index bff02e1f94d..c14692fd1a8 100644 --- a/test/spec/retryable-writes/deleteOne-errorLabels.json +++ b/test/spec/retryable-writes/deleteOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteOne-errorLabels.yml b/test/spec/retryable-writes/deleteOne-errorLabels.yml index 195f0c7912f..9ee5c7426e4 100644 --- a/test/spec/retryable-writes/deleteOne-errorLabels.yml +++ b/test/spec/retryable-writes/deleteOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/deleteOne-serverErrors.json b/test/spec/retryable-writes/deleteOne-serverErrors.json index 69d225759c4..4eab2fa296a 100644 --- a/test/spec/retryable-writes/deleteOne-serverErrors.json +++ b/test/spec/retryable-writes/deleteOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/deleteOne-serverErrors.yml b/test/spec/retryable-writes/deleteOne-serverErrors.yml index 4ef220bd22b..73cab927e72 100644 --- a/test/spec/retryable-writes/deleteOne-serverErrors.yml +++ b/test/spec/retryable-writes/deleteOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndDelete-errorLabels.json b/test/spec/retryable-writes/findOneAndDelete-errorLabels.json index efa62dba2e6..60e6e0a7bc1 100644 --- a/test/spec/retryable-writes/findOneAndDelete-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndDelete-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml b/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml index af86ee2ecb5..5192c5adfef 100644 --- a/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndDelete-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndDelete-serverErrors.json b/test/spec/retryable-writes/findOneAndDelete-serverErrors.json index 0785e5d035c..4c108616141 100644 --- a/test/spec/retryable-writes/findOneAndDelete-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndDelete-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml b/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml index 50943413523..5926026f083 100644 --- a/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndDelete-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndReplace-errorLabels.json b/test/spec/retryable-writes/findOneAndReplace-errorLabels.json index d9473d139a0..afa2f47af44 100644 --- a/test/spec/retryable-writes/findOneAndReplace-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndReplace-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml b/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml index afc0494e5b6..184366163f9 100644 --- a/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndReplace-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndReplace-serverErrors.json b/test/spec/retryable-writes/findOneAndReplace-serverErrors.json index 6ebe057cfd4..64c69e2f6d7 100644 --- a/test/spec/retryable-writes/findOneAndReplace-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndReplace-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml b/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml index c825922f934..5a483e60b6d 100644 --- a/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndReplace-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json index 1926d7fa5c3..19b3a9e771c 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json +++ b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml index f0bff611567..03751d568ba 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml +++ b/test/spec/retryable-writes/findOneAndUpdate-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json index e6e369c1393..9f546049924 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json +++ b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml index 916bddae419..3c1fbe82269 100644 --- a/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml +++ b/test/spec/retryable-writes/findOneAndUpdate-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertMany-errorLabels.json b/test/spec/retryable-writes/insertMany-errorLabels.json index c78946e90a3..65fd377fa60 100644 --- a/test/spec/retryable-writes/insertMany-errorLabels.json +++ b/test/spec/retryable-writes/insertMany-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertMany-errorLabels.yml b/test/spec/retryable-writes/insertMany-errorLabels.yml index 70551bad754..9f5e1636235 100644 --- a/test/spec/retryable-writes/insertMany-errorLabels.yml +++ b/test/spec/retryable-writes/insertMany-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertMany-serverErrors.json b/test/spec/retryable-writes/insertMany-serverErrors.json index 1c6ebafc28b..7b45b506c93 100644 --- a/test/spec/retryable-writes/insertMany-serverErrors.json +++ b/test/spec/retryable-writes/insertMany-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertMany-serverErrors.yml b/test/spec/retryable-writes/insertMany-serverErrors.yml index f05a859c1cd..140329fcb8d 100644 --- a/test/spec/retryable-writes/insertMany-serverErrors.yml +++ b/test/spec/retryable-writes/insertMany-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/insertOne-errorLabels.json b/test/spec/retryable-writes/insertOne-errorLabels.json index 9b8d13d5240..d90ac5dfbd8 100644 --- a/test/spec/retryable-writes/insertOne-errorLabels.json +++ b/test/spec/retryable-writes/insertOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertOne-errorLabels.yml b/test/spec/retryable-writes/insertOne-errorLabels.yml index 0aa7498a04b..87100aa5cf3 100644 --- a/test/spec/retryable-writes/insertOne-errorLabels.yml +++ b/test/spec/retryable-writes/insertOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: [] diff --git a/test/spec/retryable-writes/insertOne-serverErrors.json b/test/spec/retryable-writes/insertOne-serverErrors.json index cb1e6f826be..ce1a85639ee 100644 --- a/test/spec/retryable-writes/insertOne-serverErrors.json +++ b/test/spec/retryable-writes/insertOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/insertOne-serverErrors.yml b/test/spec/retryable-writes/insertOne-serverErrors.yml index a098f9b1483..0a52d9ac78a 100644 --- a/test/spec/retryable-writes/insertOne-serverErrors.yml +++ b/test/spec/retryable-writes/insertOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/replaceOne-errorLabels.json b/test/spec/retryable-writes/replaceOne-errorLabels.json index 06867e5159c..6029b875dcf 100644 --- a/test/spec/retryable-writes/replaceOne-errorLabels.json +++ b/test/spec/retryable-writes/replaceOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/replaceOne-errorLabels.yml b/test/spec/retryable-writes/replaceOne-errorLabels.yml index cb5d69ff377..41939092934 100644 --- a/test/spec/retryable-writes/replaceOne-errorLabels.yml +++ b/test/spec/retryable-writes/replaceOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/replaceOne-serverErrors.json b/test/spec/retryable-writes/replaceOne-serverErrors.json index af18bcf1a2e..7457228cd75 100644 --- a/test/spec/retryable-writes/replaceOne-serverErrors.json +++ b/test/spec/retryable-writes/replaceOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/replaceOne-serverErrors.yml b/test/spec/retryable-writes/replaceOne-serverErrors.yml index 6017efe52d6..292f96ecb0e 100644 --- a/test/spec/retryable-writes/replaceOne-serverErrors.yml +++ b/test/spec/retryable-writes/replaceOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateMany.json b/test/spec/retryable-writes/updateMany.json index 14288c2860d..46fef73e742 100644 --- a/test/spec/retryable-writes/updateMany.json +++ b/test/spec/retryable-writes/updateMany.json @@ -4,7 +4,8 @@ "minServerVersion": "3.6", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateMany.yml b/test/spec/retryable-writes/updateMany.yml index 31faee4bca5..f3ab39faa32 100644 --- a/test/spec/retryable-writes/updateMany.yml +++ b/test/spec/retryable-writes/updateMany.yml @@ -1,7 +1,7 @@ runOn: - minServerVersion: "3.6" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateOne-errorLabels.json b/test/spec/retryable-writes/updateOne-errorLabels.json index 4a6be3ffbaa..5bd00cde904 100644 --- a/test/spec/retryable-writes/updateOne-errorLabels.json +++ b/test/spec/retryable-writes/updateOne-errorLabels.json @@ -4,7 +4,8 @@ "minServerVersion": "4.3.1", "topology": [ "replicaset", - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateOne-errorLabels.yml b/test/spec/retryable-writes/updateOne-errorLabels.yml index 810351e3164..6bfef3b1299 100644 --- a/test/spec/retryable-writes/updateOne-errorLabels.yml +++ b/test/spec/retryable-writes/updateOne-errorLabels.yml @@ -1,6 +1,6 @@ runOn: - minServerVersion: "4.3.1" - topology: ["replicaset", "sharded"] + topology: ["replicaset", "sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/retryable-writes/updateOne-serverErrors.json b/test/spec/retryable-writes/updateOne-serverErrors.json index bb442eb68a9..11601980199 100644 --- a/test/spec/retryable-writes/updateOne-serverErrors.json +++ b/test/spec/retryable-writes/updateOne-serverErrors.json @@ -9,7 +9,8 @@ { "minServerVersion": "4.1.7", "topology": [ - "sharded" + "sharded", + "load-balanced" ] } ], diff --git a/test/spec/retryable-writes/updateOne-serverErrors.yml b/test/spec/retryable-writes/updateOne-serverErrors.yml index 28eb1c7a0ad..35ed406a540 100644 --- a/test/spec/retryable-writes/updateOne-serverErrors.yml +++ b/test/spec/retryable-writes/updateOne-serverErrors.yml @@ -4,7 +4,7 @@ runOn: topology: ["replicaset"] - minServerVersion: "4.1.7" - topology: ["sharded"] + topology: ["sharded", "load-balanced"] data: - { _id: 1, x: 11 } diff --git a/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json new file mode 100644 index 00000000000..d2e34478e64 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.json @@ -0,0 +1,28 @@ +{ + "description": "Load balancer can be discovered and only has the address property set", + "uri": "mongodb://a/?loadBalanced=true", + "phases": [ + { + "outcome": { + "servers": { + "a:27017": { + "type": "LoadBalancer", + "setName": null, + "setVersion": null, + "electionId": null, + "logicalSessionTimeoutMinutes": null, + "minWireVersion": null, + "maxWireVersion": null, + "topologyVersion": null + } + }, + "topologyType": "LoadBalanced", + "setName": null, + "logicalSessionTimeoutMinutes": null, + "maxSetVersion": null, + "maxElectionId": null, + "compatible": true + } + } + ] +} diff --git a/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml new file mode 100644 index 00000000000..549f4c7d8e2 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/load-balanced/discover_load_balancer.yml @@ -0,0 +1,22 @@ +description: "Load balancer can be discovered and only has the address property set" +uri: "mongodb://a/?loadBalanced=true" +phases: + # There should be no monitoring in LoadBalanced mode, so no responses are necessary to get the topology into the + # correct state. + - outcome: + servers: + a:27017: + type: LoadBalancer + setName: null + setVersion: null + electionId: null + logicalSessionTimeoutMinutes: null + minWireVersion: null + maxWireVersion: null + topologyVersion: null + topologyType: LoadBalanced + setName: null + logicalSessionTimeoutMinutes: null + maxSetVersion: null + maxElectionId: null + compatible: true diff --git a/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json new file mode 100644 index 00000000000..09b15371934 --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.json @@ -0,0 +1,93 @@ +{ + "description": "Monitoring a load balancer", + "uri": "mongodb://a:27017/?loadBalanced=true", + "phases": [ + { + "outcome": { + "events": [ + { + "topology_opening_event": { + "topologyId": "42" + } + }, + { + "topology_description_changed_event": { + "topologyId": "42", + "previousDescription": { + "topologyType": "Unknown", + "servers": [] + }, + "newDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + } + ] + } + } + }, + { + "server_opening_event": { + "topologyId": "42", + "address": "a:27017" + } + }, + { + "server_description_changed_event": { + "topologyId": "42", + "address": "a:27017", + "previousDescription": { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + }, + "newDescription": { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "LoadBalancer" + } + } + }, + { + "topology_description_changed_event": { + "topologyId": "42", + "previousDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "Unknown" + } + ] + }, + "newDescription": { + "topologyType": "LoadBalanced", + "servers": [ + { + "address": "a:27017", + "arbiters": [], + "hosts": [], + "passives": [], + "type": "LoadBalancer" + } + ] + } + } + } + ] + } + } + ] +} diff --git a/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml new file mode 100644 index 00000000000..b4eec2d2c6e --- /dev/null +++ b/test/spec/server-discovery-and-monitoring/monitoring/load_balancer.yml @@ -0,0 +1,65 @@ +description: "Monitoring a load balancer" +uri: "mongodb://a:27017/?loadBalanced=true" +phases: + - + outcome: + events: + - + topology_opening_event: + topologyId: "42" + - + topology_description_changed_event: + topologyId: "42" + previousDescription: + topologyType: "Unknown" + servers: [] + newDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + - + server_opening_event: + topologyId: "42" + address: "a:27017" + - + server_description_changed_event: + topologyId: "42" + address: "a:27017" + previousDescription: + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + newDescription: + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "LoadBalancer" + - + topology_description_changed_event: + topologyId: "42" + previousDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "Unknown" + newDescription: + topologyType: "LoadBalanced" + servers: + - + address: "a:27017" + arbiters: [] + hosts: [] + passives: [] + type: "LoadBalancer" diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json new file mode 100644 index 00000000000..e52e343332a --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Nearest", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml new file mode 100644 index 00000000000..2e9a16d5e09 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Nearest.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json new file mode 100644 index 00000000000..5a4a0aa93ac --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.json @@ -0,0 +1,30 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "Primary" + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml new file mode 100644 index 00000000000..72ea728d6ef --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Primary.yml @@ -0,0 +1,14 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Primary +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json new file mode 100644 index 00000000000..9aa151cd06e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "PrimaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml new file mode 100644 index 00000000000..96e6ff54c20 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/PrimaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: PrimaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json new file mode 100644 index 00000000000..c49e30370b4 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "Secondary", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml new file mode 100644 index 00000000000..2f027d2dc7f --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/Secondary.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json new file mode 100644 index 00000000000..18e46877b49 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "read", + "read_preference": { + "mode": "SecondaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml new file mode 100644 index 00000000000..f3da0ec4b0e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/read/SecondaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: read +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json new file mode 100644 index 00000000000..e52e343332a --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Nearest", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml new file mode 100644 index 00000000000..8e7b59dc4aa --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Nearest.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Nearest + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json new file mode 100644 index 00000000000..9061b25208e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.json @@ -0,0 +1,30 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Primary" + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml new file mode 100644 index 00000000000..457eb53e588 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Primary.yml @@ -0,0 +1,14 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Primary +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json new file mode 100644 index 00000000000..5c94dc410df --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "PrimaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml new file mode 100644 index 00000000000..2a078d1f40e --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/PrimaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: PrimaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json new file mode 100644 index 00000000000..5493867e12d --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "Secondary", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml new file mode 100644 index 00000000000..dc67dbc9425 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/Secondary.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: Secondary + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json new file mode 100644 index 00000000000..f7905f1d5f6 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.json @@ -0,0 +1,35 @@ +{ + "topology_description": { + "type": "LoadBalanced", + "servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] + }, + "operation": "write", + "read_preference": { + "mode": "SecondaryPreferred", + "tag_sets": [ + { + "data_center": "nyc" + } + ] + }, + "suitable_servers": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ], + "in_latency_window": [ + { + "address": "g:27017", + "avg_rtt_ms": 0, + "type": "LoadBalancer" + } + ] +} diff --git a/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml new file mode 100644 index 00000000000..77026a67c07 --- /dev/null +++ b/test/spec/server-selection/server_selection/LoadBalanced/write/SecondaryPreferred.yml @@ -0,0 +1,16 @@ +topology_description: + type: LoadBalanced + servers: + - &1 + address: g:27017 + avg_rtt_ms: 0 + type: LoadBalancer +operation: write +read_preference: + mode: SecondaryPreferred + tag_sets: + - data_center: nyc +suitable_servers: +- *1 +in_latency_window: +- *1 diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json new file mode 100644 index 00000000000..d94863ed11e --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.json @@ -0,0 +1,18 @@ +{ + "description": "entity-client-storeEventsAsEntities-minItems", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml new file mode 100644 index 00000000000..b52648f4f26 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-minItems.yml @@ -0,0 +1,12 @@ +description: "entity-client-storeEventsAsEntities-minItems" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: [] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json new file mode 100644 index 00000000000..79f6b85ed20 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.json @@ -0,0 +1,18 @@ +{ + "description": "entity-client-storeEventsAsEntities-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": 0 + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml new file mode 100644 index 00000000000..8230566aee9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/entity-client-storeEventsAsEntities-type.yml @@ -0,0 +1,12 @@ +description: "entity-client-storeEventsAsEntities-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json new file mode 100644 index 00000000000..110ce7869e6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckOutFailedEvent-reason-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckOutFailedEvent": { + "reason": 10 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml new file mode 100644 index 00000000000..f86972968d0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutFailedEvent-reason-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckOutFailedEvent-reason-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckOutFailedEvent: + reason: 10 diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json new file mode 100644 index 00000000000..f84e208d6a6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckOutStartedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml new file mode 100644 index 00000000000..e3aa7e6bce3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckOutStartedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckOutStartedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json new file mode 100644 index 00000000000..56ffcdee72c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckedInEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedInEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml new file mode 100644 index 00000000000..d610c94019c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedInEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckedInEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckedInEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json new file mode 100644 index 00000000000..9b804aad0a5 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCheckedOutEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCheckedOutEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml new file mode 100644 index 00000000000..560b8569e3d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCheckedOutEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCheckedOutEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCheckedOutEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json new file mode 100644 index 00000000000..053cd0b4132 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionClosedEvent-reason-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionClosedEvent": { + "reason": 10 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml new file mode 100644 index 00000000000..06a1d39266f --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionClosedEvent-reason-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionClosedEvent-reason-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionClosedEvent: + reason: 10 diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json new file mode 100644 index 00000000000..c2edc3f6aae --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionCreatedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionCreatedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml new file mode 100644 index 00000000000..1ff92d5f628 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionCreatedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionCreatedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionCreatedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json new file mode 100644 index 00000000000..994fb633146 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-connectionReadyEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml new file mode 100644 index 00000000000..2835190c06d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-connectionReadyEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-connectionReadyEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - connectionReadyEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..5a1a25d4638 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolClearedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClearedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..156581d53ac --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClearedEvent-hasServiceId-type.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolClearedEvent-hasServiceId-type + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolClearedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json new file mode 100644 index 00000000000..c181707f4a2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolClosedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolClosedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml new file mode 100644 index 00000000000..1ff0220e598 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolClosedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolClosedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolClosedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json new file mode 100644 index 00000000000..6aaa59a600b --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolCreatedEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolCreatedEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml new file mode 100644 index 00000000000..fd9c8c00465 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolCreatedEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolCreatedEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolCreatedEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json new file mode 100644 index 00000000000..66c803a5d87 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.json @@ -0,0 +1,23 @@ +{ + "description": "expectedCmapEvent-poolReadyEvent-additionalProperties", + "schemaVersion": "1.3", + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "poolReadyEvent": { + "foo": "bar" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml new file mode 100644 index 00000000000..dd2ad8a5dec --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCmapEvent-poolReadyEvent-additionalProperties.yml @@ -0,0 +1,13 @@ +description: expectedCmapEvent-poolReadyEvent-additionalProperties + +schemaVersion: '1.3' + +tests: + - description: foo + operations: [] + expectEvents: + - client: client0 + eventType: cmap + events: + - poolReadyEvent: + foo: bar diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json new file mode 100644 index 00000000000..9e45cbadda8 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.json @@ -0,0 +1,27 @@ +{ + "description": "expectedCommandEvent-additionalProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "foo": 0 + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml new file mode 100644 index 00000000000..f68da7c7102 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-additionalProperties.yml @@ -0,0 +1,15 @@ +description: "expectedCommandEvent-additionalProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json new file mode 100644 index 00000000000..a571d8e0c06 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandFailedEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandFailedEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml new file mode 100644 index 00000000000..41fc57d3a1b --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandFailedEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandFailedEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..5314dc9f804 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandFailedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandFailedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..afb3292e541 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandFailedEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandFailedEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandFailedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json new file mode 100644 index 00000000000..996332d27da --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-additionalProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "foo": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml new file mode 100644 index 00000000000..d668092f6e0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-additionalProperties.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-additionalProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json new file mode 100644 index 00000000000..8f89460617a --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-command-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml new file mode 100644 index 00000000000..ffedc4ac2d6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-command-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-command-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json new file mode 100644 index 00000000000..121947b06fd --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml new file mode 100644 index 00000000000..97331a0ce12 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json new file mode 100644 index 00000000000..97d2b84f681 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-databaseName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "databaseName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml new file mode 100644 index 00000000000..9a5786bb797 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-databaseName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandStartedEvent-databaseName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + databaseName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json new file mode 100644 index 00000000000..39ab925efb1 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandStartedEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..83d0c7a483d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandStartedEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandStartedEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json new file mode 100644 index 00000000000..bde2f4817b0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-commandName-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "commandName": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml new file mode 100644 index 00000000000..f4e7dd93c99 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-commandName-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandSucceededEvent-commandName-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json new file mode 100644 index 00000000000..edc9d3cd723 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-hasServiceId-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "hasServiceId": "foo" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml new file mode 100644 index 00000000000..15dd9833694 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-hasServiceId-type.yml @@ -0,0 +1,16 @@ +description: expectedCommandEvent-commandSucceededEvent-hasServiceId-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: foo + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + hasServiceId: foo diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json new file mode 100644 index 00000000000..9df04acd29e --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.json @@ -0,0 +1,29 @@ +{ + "description": "expectedCommandEvent-commandSucceededEvent-reply-type", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandSucceededEvent": { + "reply": 0 + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml new file mode 100644 index 00000000000..477fe7919e9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-commandSucceededEvent-reply-type.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-commandSucceededEvent-reply-type" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandSucceededEvent: + reply: 0 diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json new file mode 100644 index 00000000000..dd8b0e7e7c3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.json @@ -0,0 +1,28 @@ +{ + "description": "expectedCommandEvent-maxProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": {}, + "commandSucceededEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml new file mode 100644 index 00000000000..62d5bb4fec2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-maxProperties.yml @@ -0,0 +1,16 @@ +description: "expectedCommandEvent-maxProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - commandStartedEvent: {} + commandSucceededEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json new file mode 100644 index 00000000000..0f3e711a18c --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.json @@ -0,0 +1,25 @@ +{ + "description": "expectedCommandEvent-minProperties", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + {} + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml new file mode 100644 index 00000000000..3b7d08d412d --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedCommandEvent-minProperties.yml @@ -0,0 +1,15 @@ +description: "expectedCommandEvent-minProperties" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 "client0" + +tests: + - description: "foo" + operations: [] + expectEvents: + - client: *client0 + events: + - {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json index 6ecf5931fb6..90ed9c3273c 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.json @@ -11,17 +11,12 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [], - "foo": 0 - } - ] + "client": "client0", + "events": [], + "foo": 0 } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml index a15835d1ca2..9784c02ec15 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-additionalProperties.yml @@ -8,10 +8,8 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: [] - foo: 0 + operations: [] + expectEvents: + - client: *client0 + events: [] + foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json index b879db85987..24b6330de72 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.json @@ -11,15 +11,10 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "events": [] - } - ] + "events": [] } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml index 57db7b07e26..beba7080b03 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-required.yml @@ -8,8 +8,6 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - events: [] + operations: [] + expectEvents: + - events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json index 4ee5427df14..6e66857ee69 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.json @@ -11,16 +11,11 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": 0, - "events": [] - } - ] + "client": 0, + "events": [] } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml index 015fd7849b6..8d572fc4519 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-client-type.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: 0 - events: [] + operations: [] + expectEvents: + - client: 0 + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json new file mode 100644 index 00000000000..6e26cfaa7e3 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.json @@ -0,0 +1,24 @@ +{ + "description": "expectedEventsForClient-eventType-enum", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid eventType value", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "foo", + "events": [] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml new file mode 100644 index 00000000000..792e7521306 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-enum.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-eventType-enum + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid eventType value + operations: [] + expectEvents: + - client: *client0 + eventType: foo + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json new file mode 100644 index 00000000000..105bb001e5a --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.json @@ -0,0 +1,24 @@ +{ + "description": "expectedEventsForClient-eventType-type", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid eventType type", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": 10, + "events": [] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml new file mode 100644 index 00000000000..ce1b0c97981 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-eventType-type.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-eventType-type + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid eventType type + operations: [] + expectEvents: + - client: *client0 + eventType: 10 + events: [] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json index ee8ce4a403c..c1fcd4a6c3b 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.json @@ -11,17 +11,12 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - 0 - ] - } + "client": "client0", + "events": [ + 0 ] } ] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml index e5a6f4606b8..1c3b927f9af 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-items.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: [0] + operations: [] + expectEvents: + - client: *client0 + events: [0] diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json index 7f1bc6fb53a..39c1e9e12d6 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.json @@ -11,15 +11,10 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0" - } - ] + "client": "client0" } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml index dd14eb2b8ee..86d162eba7f 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-required.yml @@ -8,8 +8,6 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 + operations: [] + expectEvents: + - client: *client0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json index f171fc2b935..4199d042b02 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.json @@ -11,16 +11,11 @@ "tests": [ { "description": "foo", - "operations": [ + "operations": [], + "expectEvents": [ { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": 0 - } - ] + "client": "client0", + "events": 0 } ] } diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml index b51730f4ff7..24bd318ccf8 100644 --- a/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events-type.yml @@ -8,9 +8,7 @@ createEntities: tests: - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: 0 + operations: [] + expectEvents: + - client: *client0 + events: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json new file mode 100644 index 00000000000..b3802199120 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.json @@ -0,0 +1,28 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_cmap_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is cmap", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "commandStartedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml new file mode 100644 index 00000000000..681d23429d0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_cmap_eventType.yml @@ -0,0 +1,16 @@ +description: expectedEventsForClient-events_conflicts_with_cmap_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is cmap + operations: [] + expectEvents: + - client: *client0 + eventType: cmap + events: + - commandStartedEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json new file mode 100644 index 00000000000..08446fe1804 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.json @@ -0,0 +1,28 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_command_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is command", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "eventType": "command", + "events": [ + { + "poolCreatedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml new file mode 100644 index 00000000000..1e0788edc02 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_command_eventType.yml @@ -0,0 +1,16 @@ +description: expectedEventsForClient-events_conflicts_with_command_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is command + operations: [] + expectEvents: + - client: *client0 + eventType: command + events: + - poolCreatedEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json new file mode 100644 index 00000000000..c31efbb8b7e --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.json @@ -0,0 +1,27 @@ +{ + "description": "expectedEventsForClient-events_conflicts_with_default_eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + } + ], + "tests": [ + { + "description": "invalid event when eventType is unset", + "operations": [], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "poolCreatedEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml new file mode 100644 index 00000000000..49048bf2d24 --- /dev/null +++ b/test/spec/unified-test-format/invalid/expectedEventsForClient-events_conflicts_with_default_eventType.yml @@ -0,0 +1,15 @@ +description: expectedEventsForClient-events_conflicts_with_default_eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + +tests: + - description: invalid event when eventType is unset + operations: [] + expectEvents: + - client: *client0 + events: + - poolCreatedEvent: {} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json new file mode 100644 index 00000000000..b47e6be2a1d --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.json @@ -0,0 +1,19 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_expectError", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with expectError", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "expectError": { + "isError": true + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml new file mode 100644 index 00000000000..75dd8340a05 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectError.yml @@ -0,0 +1,12 @@ +description: operation-ignoreResultAndError-conflicts_with_expectError + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with expectError + operations: + - name: foo + object: bar + ignoreResultAndError: true + expectError: + isError: true diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json new file mode 100644 index 00000000000..03c5a1dbbcf --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.json @@ -0,0 +1,17 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_expectResult", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with expectResult", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "expectResult": 1 + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml new file mode 100644 index 00000000000..6c51c07b8e4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_expectResult.yml @@ -0,0 +1,11 @@ +description: operation-ignoreResultAndError-conflicts_with_expectResult + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with expectResult + operations: + - name: foo + object: bar + ignoreResultAndError: true + expectResult: 1 diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json new file mode 100644 index 00000000000..6745dff2eb2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.json @@ -0,0 +1,17 @@ +{ + "description": "operation-ignoreResultAndError-conflicts_with_saveResultAsEntity", + "schemaVersion": "1.3", + "tests": [ + { + "description": "ignoreResultAndError used with saveResultAsEntity", + "operations": [ + { + "name": "foo", + "object": "bar", + "ignoreResultAndError": true, + "saveResultAsEntity": "entity0" + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml new file mode 100644 index 00000000000..4f514352d0e --- /dev/null +++ b/test/spec/unified-test-format/invalid/operation-ignoreResultAndError-conflicts_with_saveResultAsEntity.yml @@ -0,0 +1,11 @@ +description: operation-ignoreResultAndError-conflicts_with_saveResultAsEntity + +schemaVersion: '1.3' + +tests: + - description: ignoreResultAndError used with saveResultAsEntity + operations: + - name: foo + object: bar + ignoreResultAndError: true + saveResultAsEntity: entity0 diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json new file mode 100644 index 00000000000..e5475d079d4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-auth-type", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "auth": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml new file mode 100644 index 00000000000..1a8a547fbca --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-auth-type.yml @@ -0,0 +1,10 @@ +description: runOnRequirement-auth-type + +schemaVersion: '1.3' + +runOnRequirements: + - auth: foo + +tests: + - description: foo + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json new file mode 100644 index 00000000000..5357da8d8db --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.json @@ -0,0 +1,26 @@ +{ + "description": "storeEventsAsEntity-additionalProperties", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "CommandStartedEvent" + ], + "foo": 0 + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml new file mode 100644 index 00000000000..5c1b511efa6 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-additionalProperties.yml @@ -0,0 +1,15 @@ +description: "storeEventsAsEntity-additionalProperties" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: ["CommandStartedEvent"] + foo: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json new file mode 100644 index 00000000000..ee99a55381c --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.json @@ -0,0 +1,25 @@ +{ + "description": "storeEventsAsEntity-events-enum", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "foo" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml new file mode 100644 index 00000000000..efaa05a3414 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-enum.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-enum" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: ["foo"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json new file mode 100644 index 00000000000..ddab042b1b4 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.json @@ -0,0 +1,23 @@ +{ + "description": "storeEventsAsEntity-events-minItems", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml new file mode 100644 index 00000000000..c4212476892 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-minItems.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-minItems" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: [] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json new file mode 100644 index 00000000000..90b45918ced --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.json @@ -0,0 +1,22 @@ +{ + "description": "storeEventsAsEntity-events-required", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events" + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml new file mode 100644 index 00000000000..a6a1069c815 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-required.yml @@ -0,0 +1,13 @@ +description: "storeEventsAsEntity-events-required" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json new file mode 100644 index 00000000000..1b920ebd5d2 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.json @@ -0,0 +1,23 @@ +{ + "description": "storeEventsAsEntity-events-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": 0 + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml new file mode 100644 index 00000000000..aef85082b3f --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-events-type.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-events-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: "client0_events" + events: 0 + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json new file mode 100644 index 00000000000..71387c53150 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.json @@ -0,0 +1,24 @@ +{ + "description": "storeEventsAsEntity-id-required", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "events": [ + "CommandStartedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml new file mode 100644 index 00000000000..ef334226460 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-required.yml @@ -0,0 +1,13 @@ +description: "storeEventsAsEntity-id-required" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - events: ["CommandStartedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json new file mode 100644 index 00000000000..4f52dc25332 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.json @@ -0,0 +1,25 @@ +{ + "description": "storeEventsAsEntity-id-type", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": 0, + "events": [ + "CommandStartedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml new file mode 100644 index 00000000000..1fbfdab6916 --- /dev/null +++ b/test/spec/unified-test-format/invalid/storeEventsAsEntity-id-type.yml @@ -0,0 +1,14 @@ +description: "storeEventsAsEntity-id-type" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 "client0" + storeEventsAsEntities: + - id: 0 + events: ["CommandStartedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json new file mode 100644 index 00000000000..9799bb2f651 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.json @@ -0,0 +1,63 @@ +{ + "description": "assertNumberConnectionsCheckedOut", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + } + ], + "tests": [ + { + "description": "operation fails if client field is not specified", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "connections": 1 + } + } + ] + }, + { + "description": "operation fails if connections field is not specified", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0" + } + } + ] + }, + { + "description": "operation fails if client entity does not exist", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client1" + } + } + ] + }, + { + "description": "operation fails if number of connections is incorrect", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 1 + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml new file mode 100644 index 00000000000..8a8aa63667a --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/assertNumberConnectionsCheckedOut.yml @@ -0,0 +1,38 @@ +description: assertNumberConnectionsCheckedOut + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + +tests: + - description: operation fails if client field is not specified + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + connections: 1 + + - description: operation fails if connections field is not specified + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + + - description: operation fails if client entity does not exist + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: client1 + + - description: operation fails if number of connections is incorrect + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 1 diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json new file mode 100644 index 00000000000..8c0c4d2041e --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json @@ -0,0 +1,28 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_with_client_id", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml new file mode 100644 index 00000000000..b7055c9db38 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.yml @@ -0,0 +1,16 @@ +description: "entity-client-storeEventsAsEntities-conflict_with_client_id" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + # Using the client ID here will ensure that test runners also detect + # conflicts with the same entity being defined + - id: *client0 + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json new file mode 100644 index 00000000000..77bc4abf2ec --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json @@ -0,0 +1,43 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_within_different_array", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + } + ] + } + }, + { + "client": { + "id": "client1", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml new file mode 100644 index 00000000000..8836445c9d1 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.yml @@ -0,0 +1,19 @@ +description: "entity-client-storeEventsAsEntities-conflict_within_different_array" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: &events events + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + - client: + id: &client1 client1 + storeEventsAsEntities: + - id: *events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json new file mode 100644 index 00000000000..e1a94998830 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json @@ -0,0 +1,36 @@ +{ + "description": "entity-client-storeEventsAsEntities-conflict_within_same_array", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "events", + "events": [ + "PoolCreatedEvent", + "PoolReadyEvent", + "PoolClearedEvent", + "PoolClosedEvent" + ] + }, + { + "id": "events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml new file mode 100644 index 00000000000..25ee7400d39 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.yml @@ -0,0 +1,16 @@ +description: "entity-client-storeEventsAsEntities-conflict_within_same_array" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: &events events + events: ["PoolCreatedEvent", "PoolReadyEvent", "PoolClearedEvent", "PoolClosedEvent"] + - id: *events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/valid-fail/entity-find-cursor.json b/test/spec/unified-test-format/valid-fail/entity-find-cursor.json new file mode 100644 index 00000000000..f4c5bcdf487 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-find-cursor.json @@ -0,0 +1,62 @@ +{ + "description": "entity-find-cursor", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0Name", + "collectionName": "coll0", + "documents": [] + } + ], + "tests": [ + { + "description": "createFindCursor fails if filter is not specified", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "saveResultAsEntity": "cursor0" + } + ] + }, + { + "description": "iterateUntilDocumentOrError fails if it references a nonexistent entity", + "operations": [ + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0" + } + ] + }, + { + "description": "close fails if it references a nonexistent entity", + "operations": [ + { + "name": "close", + "object": "cursor0" + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml b/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml new file mode 100644 index 00000000000..ac35615feec --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/entity-find-cursor.yml @@ -0,0 +1,37 @@ +description: entity-find-cursor + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: [] + +tests: + - description: createFindCursor fails if filter is not specified + operations: + - name: createFindCursor + object: *collection0 + saveResultAsEntity: &cursor0 cursor0 + + - description: iterateUntilDocumentOrError fails if it references a nonexistent entity + operations: + - name: iterateUntilDocumentOrError + object: cursor0 + + - description: close fails if it references a nonexistent entity + operations: + - name: close + object: cursor0 diff --git a/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json new file mode 100644 index 00000000000..4457040b4fd --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.json @@ -0,0 +1,72 @@ +{ + "description": "ignoreResultAndError", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "operation errors are not ignored if ignoreResultAndError is false", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + }, + "ignoreResultAndError": false + } + ] + }, + { + "description": "malformed operation fails if ignoreResultAndError is true", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "foo": "bar" + }, + "ignoreResultAndError": true + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml new file mode 100644 index 00000000000..52498627a54 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/ignoreResultAndError.yml @@ -0,0 +1,43 @@ +description: ignoreResultAndError + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: operation errors are not ignored if ignoreResultAndError is false + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + - name: insertOne + object: *collection0 + arguments: + # Insert the same document to force a DuplicateKey error. + document: *insertDocument + ignoreResultAndError: false + + - description: malformed operation fails if ignoreResultAndError is true + operations: + - name: insertOne + object: *collection0 + arguments: + foo: bar + ignoreResultAndError: true diff --git a/test/spec/unified-test-format/valid-fail/operation-failure.json b/test/spec/unified-test-format/valid-fail/operation-failure.json new file mode 100644 index 00000000000..8f6cae1521c --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/operation-failure.json @@ -0,0 +1,56 @@ +{ + "description": "operation-failure", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0" + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "operation-failure" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "tests": [ + { + "description": "Unsupported command", + "operations": [ + { + "name": "runCommand", + "object": "database0", + "arguments": { + "commandName": "unsupportedCommand", + "command": { + "unsupportedCommand": 1 + } + } + } + ] + }, + { + "description": "Unsupported query operator", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "$unsupportedQueryOperator": 1 + } + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-fail/operation-failure.yml b/test/spec/unified-test-format/valid-fail/operation-failure.yml new file mode 100644 index 00000000000..b80f7794df7 --- /dev/null +++ b/test/spec/unified-test-format/valid-fail/operation-failure.yml @@ -0,0 +1,31 @@ +description: "operation-failure" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + - database: + id: &database0 database0 + client: *client0 + databaseName: operation-failure + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: coll0 + +tests: + - description: "Unsupported command" + operations: + - name: runCommand + object: *database0 + arguments: + commandName: unsupportedCommand + command: { unsupportedCommand: 1 } + + - description: "Unsupported query operator" + operations: + - name: find + object: *collection0 + arguments: + filter: { $unsupportedQueryOperator: 1 } diff --git a/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json new file mode 100644 index 00000000000..a9fc063f330 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.json @@ -0,0 +1,27 @@ +{ + "description": "assertNumberConnectionsCheckedOut", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + } + ], + "tests": [ + { + "description": "basic assertion succeeds", + "operations": [ + { + "name": "assertNumberConnectionsCheckedOut", + "object": "testRunner", + "arguments": { + "client": "client0", + "connections": 0 + } + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml new file mode 100644 index 00000000000..603552fc202 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/assertNumberConnectionsCheckedOut.yml @@ -0,0 +1,17 @@ +description: assertNumberConnectionsCheckedOut + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + +tests: + - description: basic assertion succeeds + operations: + - name: assertNumberConnectionsCheckedOut + object: testRunner + arguments: + client: *client0 + connections: 0 diff --git a/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json new file mode 100644 index 00000000000..3209033def4 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.json @@ -0,0 +1,71 @@ +{ + "description": "entity-client-cmap-events", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "connectionReadyEvent", + "connectionCheckedOutEvent", + "connectionCheckedInEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "events are captured during an operation", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "x": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + }, + { + "connectionCheckedOutEvent": {} + }, + { + "connectionCheckedInEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml new file mode 100644 index 00000000000..277134551ce --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-cmap-events.yml @@ -0,0 +1,40 @@ +description: entity-client-cmap-events + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - connectionReadyEvent + - connectionCheckedOutEvent + - connectionCheckedInEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: events are captured during an operation + operations: + - name: insertOne + object: *collection0 + arguments: + document: { x: 1 } + expectEvents: + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + - connectionCheckedOutEvent: {} + - connectionCheckedInEvent: {} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json new file mode 100644 index 00000000000..e37e5a1acd9 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.json @@ -0,0 +1,67 @@ +{ + "description": "entity-client-storeEventsAsEntities", + "schemaVersion": "1.2", + "createEntities": [ + { + "client": { + "id": "client0", + "storeEventsAsEntities": [ + { + "id": "client0_events", + "events": [ + "CommandStartedEvent", + "CommandSucceededEvent", + "CommandFailedEvent" + ] + } + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "test" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "test", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "storeEventsAsEntities captures events", + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": {} + }, + "expectResult": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml new file mode 100644 index 00000000000..52a9e0ddc7a --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-client-storeEventsAsEntities.yml @@ -0,0 +1,37 @@ +description: "entity-client-storeEventsAsEntities" + +schemaVersion: "1.2" + +createEntities: + - client: + id: &client0 client0 + storeEventsAsEntities: + - id: client0_events + events: ["CommandStartedEvent", "CommandSucceededEvent", "CommandFailedEvent"] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name test + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + # Note: this test does not assert that the events are actually saved to the + # entity since there is presently no assertion syntax to do so. We are only + # asserting that the test executes successfully. + - description: "storeEventsAsEntities captures events" + operations: + - name: find + object: *collection0 + arguments: + filter: {} + expectResult: + - { _id: 1, x: 11 } diff --git a/test/spec/unified-test-format/valid-pass/entity-find-cursor.json b/test/spec/unified-test-format/valid-pass/entity-find-cursor.json new file mode 100644 index 00000000000..85b8f69d7f3 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-find-cursor.json @@ -0,0 +1,182 @@ +{ + "description": "entity-find-cursor", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent", + "commandSucceededEvent", + "commandFailedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "databaseName": "database0Name", + "collectionName": "coll0", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + }, + { + "_id": 3 + }, + { + "_id": 4 + }, + { + "_id": 5 + } + ] + } + ], + "tests": [ + { + "description": "cursors can be created, iterated, and closed", + "operations": [ + { + "name": "createFindCursor", + "object": "collection0", + "arguments": { + "filter": {}, + "batchSize": 2 + }, + "saveResultAsEntity": "cursor0" + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 1 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 2 + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "cursor0", + "expectResult": { + "_id": 3 + } + }, + { + "name": "close", + "object": "cursor0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": {}, + "batchSize": 2 + }, + "commandName": "find", + "databaseName": "database0Name" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "ns": { + "$$type": "string" + }, + "firstBatch": { + "$$type": "array" + } + } + }, + "commandName": "find" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": "long" + }, + "collection": "coll0" + }, + "commandName": "getMore" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursor": { + "id": { + "$$type": "long" + }, + "ns": { + "$$type": "string" + }, + "nextBatch": { + "$$type": "array" + } + } + }, + "commandName": "getMore" + } + }, + { + "commandStartedEvent": { + "command": { + "killCursors": "coll0", + "cursors": { + "$$type": "array" + } + }, + "commandName": "killCursors" + } + }, + { + "commandSucceededEvent": { + "reply": { + "cursorsKilled": { + "$$unsetOrMatches": { + "$$type": "array" + } + } + }, + "commandName": "killCursors" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml b/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml new file mode 100644 index 00000000000..61c9f8835ac --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/entity-find-cursor.yml @@ -0,0 +1,89 @@ +description: entity-find-cursor + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - commandSucceededEvent + - commandFailedEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - databaseName: *database0Name + collectionName: *collection0Name + documents: + - _id: 1 + - _id: 2 + - _id: 3 + - _id: 4 + - _id: 5 + +tests: + - description: cursors can be created, iterated, and closed + operations: + - name: createFindCursor + object: *collection0 + arguments: + filter: {} + batchSize: 2 + saveResultAsEntity: &cursor0 cursor0 + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 1 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 2 } + - name: iterateUntilDocumentOrError + object: *cursor0 + expectResult: { _id: 3 } + - name: close + object: *cursor0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: {} + batchSize: 2 + commandName: find + databaseName: *database0Name + - commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + ns: { $$type: string } + firstBatch: { $$type: array } + commandName: find + - commandStartedEvent: + command: + getMore: { $$type: long } + collection: *collection0Name + commandName: getMore + - commandSucceededEvent: + reply: + cursor: + id: { $$type: long } + ns: { $$type: string } + nextBatch: { $$type: array } + commandName: getMore + - commandStartedEvent: + command: + killCursors: *collection0Name + cursors: { $$type: array } + commandName: killCursors + - commandSucceededEvent: + reply: + # No cursorsKilled field expected on pre-3.2 servers + cursorsKilled: { $$unsetOrMatches: { $$type: array } } + commandName: killCursors diff --git a/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json new file mode 100644 index 00000000000..fe308df9653 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.json @@ -0,0 +1,126 @@ +{ + "description": "expectedEventsForClient-eventType", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent", + "connectionReadyEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "eventType can be set to command and cmap", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "eventType": "command", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + } + ] + } + ] + }, + { + "description": "eventType defaults to command if unset", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 1 + } + ] + }, + "commandName": "insert" + } + } + ] + }, + { + "client": "client0", + "eventType": "cmap", + "events": [ + { + "connectionReadyEvent": {} + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml new file mode 100644 index 00000000000..e437c80489b --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/expectedEventsForClient-eventType.yml @@ -0,0 +1,66 @@ +description: expectedEventsForClient-eventType + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + observeEvents: + - commandStartedEvent + - connectionReadyEvent + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: eventType can be set to command and cmap + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + expectEvents: + - client: *client0 + eventType: command + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *insertDocument + commandName: insert + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} + + - description: eventType defaults to command if unset + operations: + - name: insertOne + object: *collection0 + arguments: + document: *insertDocument + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *insertDocument + commandName: insert + - client: *client0 + eventType: cmap + events: + - connectionReadyEvent: {} diff --git a/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json new file mode 100644 index 00000000000..2e9b1c58ab9 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.json @@ -0,0 +1,59 @@ +{ + "description": "ignoreResultAndError", + "schemaVersion": "1.3", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "database0Name" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "database0Name", + "documents": [] + } + ], + "tests": [ + { + "description": "operation errors are ignored if ignoreResultAndError is true", + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1 + } + }, + "ignoreResultAndError": true + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml new file mode 100644 index 00000000000..847e296e720 --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/ignoreResultAndError.yml @@ -0,0 +1,34 @@ +description: ignoreResultAndError + +schemaVersion: '1.3' + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name database0Name + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: [] + +tests: + - description: operation errors are ignored if ignoreResultAndError is true + operations: + - name: insertOne + object: *collection0 + arguments: + document: &insertDocument { _id: 1 } + - name: insertOne + object: *collection0 + arguments: + document: *insertDocument + ignoreResultAndError: true diff --git a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json index 499396e0baa..fe0a5ae9913 100644 --- a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json +++ b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.json @@ -57,10 +57,11 @@ ], "tests": [ { - "description": "A successful find event with a getmore and the server kills the cursor", + "description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)", "runOnRequirements": [ { "minServerVersion": "3.1", + "maxServerVersion": "4.4.99", "topologies": [ "single", "replicaset" diff --git a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml index 19a282327c4..6d5e4373494 100644 --- a/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml +++ b/test/spec/unified-test-format/valid-pass/poc-command-monitoring.yml @@ -29,9 +29,10 @@ initialData: - { _id: 5, x: 55 } tests: - - description: "A successful find event with a getmore and the server kills the cursor" + - description: "A successful find event with a getmore and the server kills the cursor (<= 4.4)" runOnRequirements: - minServerVersion: "3.1" + maxServerVersion: "4.4.99" topologies: [ single, replicaset ] operations: - name: find diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.json b/test/spec/unified-test-format/valid-pass/poc-crud.json deleted file mode 100644 index 2ed86d6150d..00000000000 --- a/test/spec/unified-test-format/valid-pass/poc-crud.json +++ /dev/null @@ -1,446 +0,0 @@ -{ - "description": "poc-crud", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client0", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - }, - { - "collection": { - "id": "collection2", - "database": "database0", - "collectionName": "coll2", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "collectionName": "coll2", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - }, - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "BulkWrite with mixed ordered operations", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "3": 4 - } - }, - "matchedCount": 3, - "modifiedCount": 3, - "upsertedCount": 1, - "upsertedIds": { - "5": 4 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 34 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", - "operations": [ - { - "name": "insertMany", - "object": "collection1", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectError": { - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "replaceOne", - "object": "collection1", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "readConcern majority with out stage", - "runOnRequirements": [ - { - "minServerVersion": "4.1.0", - "topologies": [ - "replicaset", - "sharded-replicaset" - ] - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection2", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll2", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ], - "readConcern": { - "level": "majority" - } - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $listLocalSessions", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "database1", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ] - }, - "expectResult": [ - { - "dummy": "dummy field" - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.yml b/test/spec/unified-test-format/valid-pass/poc-crud.yml deleted file mode 100644 index 7d101a077a5..00000000000 --- a/test/spec/unified-test-format/valid-pass/poc-crud.yml +++ /dev/null @@ -1,183 +0,0 @@ -description: "poc-crud" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 client0 - observeEvents: [ commandStartedEvent ] - - database: - id: &database0 database0 - client: *client0 - databaseName: &database0Name crud-tests - - database: - id: &database1 database1 - client: *client0 - databaseName: &database1Name admin - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection0Name coll0 - - collection: - id: &collection1 collection1 - database: *database0 - collectionName: &collection1Name coll1 - - collection: - id: &collection2 collection2 - database: *database0 - collectionName: &collection2Name coll2 - collectionOptions: - readConcern: { level: majority } - -initialData: - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - collectionName: *collection2Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - collectionName: &out aggregate_out - databaseName: *database0Name - documents: [] - -tests: - - description: "BulkWrite with mixed ordered operations" - operations: - - name: bulkWrite - object: *collection0 - arguments: - requests: - - insertOne: - document: { _id: 3, x: 33 } - - updateOne: - filter: { _id: 2 } - update: { $inc: { x: 1 } } - - updateMany: - filter: { _id: { $gt: 1 } } - update: { $inc: { x: 1 } } - - insertOne: - document: { _id: 4, x: 44 } - - deleteMany: - filter: { x: { $nin: [ 24, 34 ] } } - - replaceOne: - filter: { _id: 4 } - replacement: { _id: 4, x: 44 } - upsert: true - ordered: true - expectResult: - deletedCount: 2 - insertedCount: 2 - insertedIds: { $$unsetOrMatches: { 0: 3, 3: 4 } } - matchedCount: 3 - modifiedCount: 3 - upsertedCount: 1 - upsertedIds: { 5: 4 } - outcome: - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - {_id: 2, x: 24 } - - {_id: 3, x: 34 } - - {_id: 4, x: 44 } - - - description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)" - operations: - - name: insertMany - object: *collection1 - arguments: - documents: - - { _id: 2, x: 22 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - ordered: false - expectError: - expectResult: - deletedCount: 0 - insertedCount: 2 - # Since the map of insertedIds is generated before execution it - # could indicate inserts that did not actually succeed. We omit - # this field rather than expect drivers to provide an accurate - # map filtered by write errors. - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: { } - outcome: - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "ReplaceOne prohibits atomic modifiers" - operations: - - name: replaceOne - object: *collection1 - arguments: - filter: { _id: 1 } - replacement: { $set: { x: 22 }} - expectError: - isClientError: true - expectEvents: - - client: *client0 - events: [] - outcome: - - collectionName: *collection1Name - databaseName: *database0Name - documents: - - { _id: 1, x: 11 } - - - description: "readConcern majority with out stage" - runOnRequirements: - - minServerVersion: "4.1.0" - topologies: [ replicaset, sharded-replicaset ] - operations: - - name: aggregate - object: *collection2 - arguments: - pipeline: &pipeline - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $out: *out - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection2Name - pipeline: *pipeline - readConcern: { level: majority } - # The following two assertions were not in the original test - commandName: aggregate - databaseName: *database0Name - outcome: - - collectionName: *out - databaseName: *database0Name - documents: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "Aggregate with $listLocalSessions" - runOnRequirements: - - minServerVersion: "3.6.0" - operations: - - name: aggregate - object: *database1 - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1} - expectResult: - - { dummy: "dummy field" } diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml index c1ea7ec696a..b06b437f617 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-reads.yml @@ -93,7 +93,7 @@ tests: closeConnection: true # Find options and expected result changed to use common initialData - name: find - object: collection0 + object: *collection0 arguments: filter: {} sort: { _id: 1 } @@ -127,7 +127,7 @@ tests: failCommands: [ find ] closeConnection: true - name: find - object: collection1 # client uses retryReads=false + object: *collection1 # client uses retryReads=false arguments: filter: {} # Other arguments in the original test are not relevant @@ -154,7 +154,7 @@ tests: failCommands: [ find ] closeConnection: true - name: find - object: collection0 + object: *collection0 arguments: filter: {} # Other arguments in the original test are not relevant diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml index 0a6bfe6c2ec..47ded3a5fb5 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml @@ -141,7 +141,9 @@ tests: - { _id: 4, x: 44 } ordered: true expectResult: - { $$unsetOrMatches: { insertedCount: { $$unsetOrMatches: 2 } }, insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } } + $$unsetOrMatches: + insertedCount: { $$unsetOrMatches: 2 } + insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } outcome: - collectionName: *collectionName databaseName: *databaseName diff --git a/test/spec/uri-options/connection-options.json b/test/spec/uri-options/connection-options.json index 1cd7c55f08b..2b3ef2220f6 100644 --- a/test/spec/uri-options/connection-options.json +++ b/test/spec/uri-options/connection-options.json @@ -167,6 +167,73 @@ "hosts": null, "auth": null, "options": {} + }, + { + "description": "loadBalanced=true", + "uri": "mongodb://example.com/?loadBalanced=true", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "loadBalanced": true + } + }, + { + "description": "loadBalanced=false", + "uri": "mongodb://example.com/?loadBalanced=false", + "valid": true, + "warning": false, + "hosts": null, + "auth": null, + "options": { + "loadBalanced": false + } + }, + { + "description": "Invalid loadBalanced value", + "uri": "mongodb://example.com/?loadBalanced=1", + "valid": true, + "warning": true, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with multiple hosts causes an error", + "uri": "mongodb://example1,example2/?loadBalanced=true", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with directConnection=true causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&directConnection=true", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with directConnection=false causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&directConnection=false", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} + }, + { + "description": "loadBalanced=true with replicaSet causes an error", + "uri": "mongodb://example.com/?loadBalanced=true&replicaSet=replset", + "valid": false, + "warning": false, + "hosts": null, + "auth": null, + "options": {} } ] } diff --git a/test/spec/uri-options/connection-options.yml b/test/spec/uri-options/connection-options.yml index c90b88d743b..303473fe139 100644 --- a/test/spec/uri-options/connection-options.yml +++ b/test/spec/uri-options/connection-options.yml @@ -147,3 +147,61 @@ tests: hosts: ~ auth: ~ options: {} + - + description: loadBalanced=true + uri: "mongodb://example.com/?loadBalanced=true" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + loadBalanced: true + - + description: loadBalanced=false + uri: "mongodb://example.com/?loadBalanced=false" + valid: true + warning: false + hosts: ~ + auth: ~ + options: + loadBalanced: false + - + description: Invalid loadBalanced value + uri: "mongodb://example.com/?loadBalanced=1" + valid: true + warning: true + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with multiple hosts causes an error + uri: "mongodb://example1,example2/?loadBalanced=true" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with directConnection=true causes an error + uri: "mongodb://example.com/?loadBalanced=true&directConnection=true" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with directConnection=false causes an error + uri: "mongodb://example.com/?loadBalanced=true&directConnection=false" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} + - + description: loadBalanced=true with replicaSet causes an error + uri: "mongodb://example.com/?loadBalanced=true&replicaSet=replset" + valid: false + warning: false + hosts: ~ + auth: ~ + options: {} diff --git a/test/spec/versioned-api/README.rst b/test/spec/versioned-api/README.rst new file mode 100644 index 00000000000..a0b0599f643 --- /dev/null +++ b/test/spec/versioned-api/README.rst @@ -0,0 +1,37 @@ +=================== +Versioned API Tests +=================== + +.. contents:: + +---- + +Notes +===== + +This directory contains tests for the Versioned API specification. They are +implemented in the `Unified Test Format <../../unified-test-format/unified-test-format.rst>`__, +and require schema version 1.1. Note that to run these tests, the server must be +started with both ``enableTestCommands`` and ``acceptApiVersion2`` parameters +set to true. + +Testing with required API version +================================= + +Drivers MUST run their test suite against a cluster with the +``requireApiVersion`` parameter enabled and also requires authentication. + +To run this test, proceed as follows: +- Start a standalone mongod instance + +- Connect to the standalone instance and run the following command on the + ``admin`` database: ``{ setParameter: 1, requireApiVersion: true }`` + +- Declare an API version for the test run through the ``MONGODB_API_VERSION`` + environment variable. + +- If the environment variable is set, all clients created in tests MUST declare + the ``ServerApiVersion`` specified. + +No other topologies must be tested until ``mongo-orchestration`` can handle +servers with ``requireApiVersion`` enabled. diff --git a/test/unit/core/mongodb_srv.test.js b/test/unit/core/mongodb_srv.test.js index 1b6ef023b68..dd747534e3f 100644 --- a/test/unit/core/mongodb_srv.test.js +++ b/test/unit/core/mongodb_srv.test.js @@ -24,7 +24,9 @@ describe('mongodb+srv', function () { test[1].comment = test[0]; } - it(test[1].comment, { + // TODO: Remove with NODE-3011 + const maybeIt = test[1].comment.includes('loadBalanced') ? it.skip : it; + maybeIt(test[1].comment, { metadata: { requires: { topology: ['single'] } }, test: function (done) { try { diff --git a/test/unit/sdam/server_selection/spec.test.js b/test/unit/sdam/server_selection/spec.test.js index aa4c068a14a..5fd692ddd8b 100644 --- a/test/unit/sdam/server_selection/spec.test.js +++ b/test/unit/sdam/server_selection/spec.test.js @@ -68,7 +68,9 @@ describe('Server Selection (spec)', function () { describe(subType, function () { specTests[topologyType][subType].forEach(test => { // NOTE: node does not support PossiblePrimary - const maybeIt = test.name.match(/Possible/) ? it.skip : it; + // TODO: Re-enable LoadBalanced in NODE-3011 + const maybeIt = + test.name.match(/Possible/) || topologyType === 'LoadBalanced' ? it.skip : it; maybeIt(test.name, function (done) { executeServerSelectionTest(test, { checkLatencyWindow: false }, done); @@ -79,7 +81,9 @@ describe('Server Selection (spec)', function () { describe(subType + ' (within latency window)', function () { specTests[topologyType][subType].forEach(test => { // NOTE: node does not support PossiblePrimary - const maybeIt = test.name.match(/Possible/) ? it.skip : it; + // TODO: Re-enable LoadBalanced in NODE-3011 + const maybeIt = + test.name.match(/Possible/) || topologyType === 'LoadBalanced' ? it.skip : it; maybeIt(test.name, function (done) { executeServerSelectionTest(test, { checkLatencyWindow: true }, done); diff --git a/test/unit/sdam/spec.test.js b/test/unit/sdam/spec.test.js index c8827660a27..7bf2d1b4621 100644 --- a/test/unit/sdam/spec.test.js +++ b/test/unit/sdam/spec.test.js @@ -60,10 +60,13 @@ describe('Server Discovery and Monitoring (spec)', function () { }); // DRIVERS-1249 should add directConnection and then update spec, remove skip + // TODO: NODE-3011 remove LB test skips const shouldSkip = desc => { const descriptions = [ 'Monitoring a standalone connection', - 'Monitoring a standalone connection - suppress update events for equal server descriptions' + 'Monitoring a standalone connection - suppress update events for equal server descriptions', + 'Load balancer can be discovered and only has the address property set', + 'Monitoring a load balancer' ]; return descriptions.includes(desc); }; From 7aa3008d58b9d9869c2ea4af7809fa6b5cfbf6f4 Mon Sep 17 00:00:00 2001 From: Daria Pardue <81593090+dariakp@users.noreply.github.com> Date: Fri, 16 Jul 2021 10:10:12 -0400 Subject: [PATCH 4/8] fix(NODE-3393): snapshot time not applied if distinct executed first (#2908) --- src/sessions.ts | 13 +- test/functional/sessions.test.js | 26 +--- .../unified-spec-runner/operations.ts | 122 ++++++------------ 3 files changed, 50 insertions(+), 111 deletions(-) diff --git a/src/sessions.ts b/src/sessions.ts index 2b5324061f3..fb59f759523 100644 --- a/src/sessions.ts +++ b/src/sessions.ts @@ -891,11 +891,12 @@ export function updateSessionFromResponse(session: ClientSession, document: Docu session.transaction._recoveryToken = document.recoveryToken; } - if ( - document.cursor?.atClusterTime && - session?.[kSnapshotEnabled] && - session[kSnapshotTime] === undefined - ) { - session[kSnapshotTime] = document.cursor.atClusterTime; + if (session?.[kSnapshotEnabled] && session[kSnapshotTime] === undefined) { + // find and aggregate commands return atClusterTime on the cursor + // distinct includes it in the response body + const atClusterTime = document.cursor?.atClusterTime || document.atClusterTime; + if (atClusterTime) { + session[kSnapshotTime] = atClusterTime; + } } } diff --git a/test/functional/sessions.test.js b/test/functional/sessions.test.js index f0e0fb5cb75..5be0843d3c9 100644 --- a/test/functional/sessions.test.js +++ b/test/functional/sessions.test.js @@ -200,35 +200,11 @@ describe('Sessions - functional', function () { for (const sessionTests of loadSpecTests(path.join('sessions', 'unified'))) { expect(sessionTests).to.be.an('object'); context(String(sessionTests.description), function () { - // TODO: NODE-3393 fix test runner to apply session to all operations - const skipTestMap = { - 'snapshot-sessions': [ - 'countDocuments operation with snapshot', - 'Distinct operation with snapshot', - 'Mixed operation with snapshot' - ], - 'snapshot-sessions-not-supported-client-error': [ - 'Client error on distinct with snapshot' - ], - 'snapshot-sessions-not-supported-server-error': [ - 'Server returns an error on distinct with snapshot' - ], - 'snapshot-sessions-unsupported-ops': [ - 'Server returns an error on listCollections with snapshot', - 'Server returns an error on listDatabases with snapshot', - 'Server returns an error on listIndexes with snapshot', - 'Server returns an error on runCommand with snapshot', - 'Server returns an error on findOneAndUpdate with snapshot', - 'Server returns an error on deleteOne with snapshot', - 'Server returns an error on updateOne with snapshot' - ] - }; - const testsToSkip = skipTestMap[sessionTests.description] || []; for (const test of sessionTests.tests) { it(String(test.description), { metadata: { sessions: { skipLeakTests: true } }, test: async function () { - await runUnifiedTest(this, sessionTests, test, testsToSkip); + await runUnifiedTest(this, sessionTests, test); } }); } diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index a4dda6f5ed8..16ac952f883 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -4,14 +4,13 @@ import { Collection, Db, GridFSFile, MongoClient, ObjectId, AbstractCursor } fro import { ReadConcern } from '../../../src/read_concern'; import { ReadPreference } from '../../../src/read_preference'; import { WriteConcern } from '../../../src/write_concern'; -import { Document, InsertOneOptions } from '../../../src'; +import { Document } from '../../../src'; import { EventCollector } from '../../tools/utils'; import { EntitiesMap } from './entities'; import { expectErrorCheck, resultCheck } from './match'; import type { OperationDescription } from './schema'; import { CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; import { translateOptions } from './unified-utils'; -import { getSymbolFrom } from '../../tools/utils'; interface OperationFunctionParams { client: MongoClient; @@ -22,18 +21,6 @@ interface OperationFunctionParams { type RunOperationFn = (p: OperationFunctionParams) => Promise; export const operations = new Map(); -function executeWithPotentialSession( - entities: EntitiesMap, - operation: OperationDescription, - cursor: AbstractCursor -) { - const session = entities.getEntity('session', operation.arguments.session, false); - if (session) { - cursor.session = session; - } - return cursor.toArray(); -} - operations.set('abortTransaction', async ({ entities, operation }) => { const session = entities.getEntity('session', operation.object); return session.abortTransaction(); @@ -44,18 +31,9 @@ operations.set('aggregate', async ({ entities, operation }) => { if (!(dbOrCollection instanceof Db || dbOrCollection instanceof Collection)) { throw new Error(`Operation object '${operation.object}' must be a db or collection`); } - const cursor = dbOrCollection.aggregate(operation.arguments.pipeline, { - allowDiskUse: operation.arguments.allowDiskUse, - batchSize: operation.arguments.batchSize, - bypassDocumentValidation: operation.arguments.bypassDocumentValidation, - maxTimeMS: operation.arguments.maxTimeMS, - maxAwaitTimeMS: operation.arguments.maxAwaitTimeMS, - collation: operation.arguments.collation, - hint: operation.arguments.hint, - let: operation.arguments.let, - out: operation.arguments.out - }); - return executeWithPotentialSession(entities, operation, cursor); + const { pipeline, ...opts } = operation.arguments; + const cursor = dbOrCollection.aggregate(pipeline, opts); + return cursor.toArray(); }); operations.set('assertCollectionExists', async ({ operation, client }) => { @@ -139,27 +117,27 @@ operations.set('assertSameLsidOnLastTwoCommands', async ({ entities, operation } }); operations.set('assertSessionDirty', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; expect(session.serverSession.isDirty).to.be.true; }); operations.set('assertSessionNotDirty', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; expect(session.serverSession.isDirty).to.be.false; }); operations.set('assertSessionPinned', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; expect(session.transaction.isPinned).to.be.true; }); operations.set('assertSessionUnpinned', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; expect(session.transaction.isPinned).to.be.false; }); operations.set('assertSessionTransactionState', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; const transactionStateTranslation = { none: 'NO_TRANSACTION', @@ -236,17 +214,14 @@ operations.set('createChangeStream', async ({ entities, operation }) => { operations.set('createCollection', async ({ entities, operation }) => { const db = entities.getEntity('db', operation.object); - const { session, collection, ...opts } = operation.arguments; - await db.createCollection(collection, { - session: entities.getEntity('session', session, false), - ...opts - }); + const { collection, ...opts } = operation.arguments; + await db.createCollection(collection, opts); }); operations.set('createFindCursor', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - const { filter, sort, batchSize, limit, let: vars } = operation.arguments; - const cursor = collection.find(filter, { sort, batchSize, limit, let: vars }); + const { filter, ...opts } = operation.arguments; + const cursor = collection.find(filter, opts); // The spec dictates that we create the cursor and force the find command // to execute, but don't move the cursor forward. hasNext() accomplishes // this. @@ -256,11 +231,8 @@ operations.set('createFindCursor', async ({ entities, operation }) => { operations.set('createIndex', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - const session = entities.getEntity('session', operation.arguments.session, false); - await collection.createIndex(operation.arguments.keys, { - session, - name: operation.arguments.name - }); + const { keys, ...opts } = operation.arguments; + await collection.createIndex(keys, opts); }); operations.set('deleteOne', async ({ entities, operation }) => { @@ -271,7 +243,8 @@ operations.set('deleteOne', async ({ entities, operation }) => { operations.set('dropCollection', async ({ entities, operation }) => { const db = entities.getEntity('db', operation.object); - return await db.dropCollection(operation.arguments.collection); + const { collection, ...opts } = operation.arguments; + return await db.dropCollection(collection, opts); }); operations.set('endSession', async ({ entities, operation }) => { @@ -281,9 +254,8 @@ operations.set('endSession', async ({ entities, operation }) => { operations.set('find', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - const { filter, sort, batchSize, limit, let: vars } = operation.arguments; - const cursor = collection.find(filter, { sort, batchSize, limit, let: vars }); - return executeWithPotentialSession(entities, operation, cursor); + const { filter, ...opts } = operation.arguments; + return collection.find(filter, opts).toArray(); }); operations.set('findOneAndReplace', async ({ entities, operation }) => { @@ -305,27 +277,14 @@ operations.set('failPoint', async ({ entities, operation }) => { operations.set('insertOne', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - - const session = entities.getEntity('session', operation.arguments.session, false); - - const options = { - session - } as InsertOneOptions; - - return collection.insertOne(operation.arguments.document, options); + const { document, ...opts } = operation.arguments; + return collection.insertOne(document, opts); }); operations.set('insertMany', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - - const session = entities.getEntity('session', operation.arguments.session, false); - - const options = { - session, - ordered: operation.arguments.ordered ?? true - }; - - return collection.insertMany(operation.arguments.documents, options); + const { documents, ...opts } = operation.arguments; + return collection.insertMany(documents, opts); }); operations.set('iterateUntilDocumentOrError', async ({ entities, operation }) => { @@ -350,7 +309,7 @@ operations.set('listCollections', async ({ entities, operation }) => { operations.set('listDatabases', async ({ entities, operation }) => { const client = entities.getEntity('client', operation.object); - return client.db().admin().listDatabases(); + return client.db().admin().listDatabases(operation.arguments); }); operations.set('listIndexes', async ({ entities, operation }) => { @@ -360,12 +319,8 @@ operations.set('listIndexes', async ({ entities, operation }) => { operations.set('replaceOne', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - return collection.replaceOne(operation.arguments.filter, operation.arguments.replacement, { - bypassDocumentValidation: operation.arguments.bypassDocumentValidation, - collation: operation.arguments.collation, - hint: operation.arguments.hint, - upsert: operation.arguments.upsert - }); + const { filter, replacement, ...opts } = operation.arguments; + return collection.replaceOne(filter, replacement, opts); }); operations.set('startTransaction', async ({ entities, operation }) => { @@ -374,7 +329,7 @@ operations.set('startTransaction', async ({ entities, operation }) => { }); operations.set('targetedFailPoint', async ({ entities, operation }) => { - const session = entities.getEntity('session', operation.arguments.session); + const session = operation.arguments.session; expect(session.transaction.isPinned, 'Session must be pinned for a targetedFailPoint').to.be.true; await entities.failPoints.enableFailPoint( session.transaction._pinnedServer.s.description.hostAddress, @@ -433,20 +388,20 @@ operations.set('withTransaction', async ({ entities, operation, client }) => { operations.set('countDocuments', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - return collection.countDocuments(operation.arguments.filter as Document); + const { filter, ...opts } = operation.arguments; + return collection.countDocuments(filter, opts); }); operations.set('deleteMany', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - return collection.deleteMany(operation.arguments.filter); + const { filter, ...opts } = operation.arguments; + return collection.deleteMany(filter, opts); }); operations.set('distinct', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - return collection.distinct( - operation.arguments.fieldName as string, - operation.arguments.filter as Document - ); + const { fieldName, filter, ...opts } = operation.arguments; + return collection.distinct(fieldName, filter, opts); }); operations.set('estimatedDocumentCount', async ({ entities, operation }) => { @@ -456,12 +411,14 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => { operations.set('findOneAndDelete', async ({ entities, operation }) => { const collection = entities.getEntity('collection', operation.object); - return collection.findOneAndDelete(operation.arguments.filter); + const { filter, ...opts } = operation.arguments; + return collection.findOneAndDelete(filter, opts); }); operations.set('runCommand', async ({ entities, operation }: OperationFunctionParams) => { const db = entities.getEntity('db', operation.object); - return db.command(operation.arguments.command); + const { command, ...opts } = operation.arguments; + return db.command(command, opts); }); operations.set('updateMany', async ({ entities, operation }) => { @@ -484,6 +441,11 @@ export async function executeOperationAndCheck( const opFunc = operations.get(operation.name); expect(opFunc, `Unknown operation: ${operation.name}`).to.exist; + if (operation.arguments?.session) { + const session = entities.getEntity('session', operation.arguments.session, false); + operation.arguments.session = session; + } + let result; try { From 51ea86d0abfbe18a3ae0a5e41a6b8c5b974f3c3b Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Fri, 16 Jul 2021 15:50:53 -0400 Subject: [PATCH 5/8] fix(NODE-3417): allow calling `db()` before MongoClient is connected (#2889) --- src/mongo_client.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mongo_client.ts b/src/mongo_client.ts index 4053584c62a..57653cbe481 100644 --- a/src/mongo_client.ts +++ b/src/mongo_client.ts @@ -473,13 +473,6 @@ export class MongoClient extends TypedEventEmitter { // Copy the options and add out internal override of the not shared flag const finalOptions = Object.assign({}, this[kOptions], options); - // If no topology throw an error message - if (!this.topology) { - throw new MongoDriverError( - 'MongoClient must be connected before calling MongoClient.prototype.db' - ); - } - // Return the db object const db = new Db(this, dbName, finalOptions); From d2706106d041bf7ae8ce6d54c393cb743583c95d Mon Sep 17 00:00:00 2001 From: Eric Adum Date: Mon, 19 Jul 2021 11:40:49 -0400 Subject: [PATCH 6/8] test(NODE-3412): sync spec tests for serverless testing (#2911) --- src/collection.ts | 2 +- test/functional/crud_spec.test.js | 15 - .../unified-spec-runner/operations.ts | 12 +- test/spec/crud/unified/aggregate-let.json | 183 ++++++- test/spec/crud/unified/aggregate-let.yml | 59 +- test/spec/crud/unified/aggregate-merge.json | 497 +++++++++++++++++ test/spec/crud/unified/aggregate-merge.yml | 185 +++++++ .../unified/aggregate-out-readConcern.json | 407 ++++++++++++++ .../unified/aggregate-out-readConcern.yml | 171 ++++++ test/spec/crud/unified/aggregate.json | 166 ++++++ test/spec/crud/unified/aggregate.yml | 68 +++ .../bulkWrite-arrayFilters-clientError.json | 103 ++-- .../bulkWrite-arrayFilters-clientError.yml | 98 ++++ .../crud/unified/bulkWrite-arrayFilters.json | 279 ++++++++++ .../crud/unified/bulkWrite-arrayFilters.yml | 174 ++++++ .../bulkWrite-delete-hint-clientError.json | 119 ++-- .../bulkWrite-delete-hint-clientError.yml | 113 ++++ .../bulkWrite-delete-hint-serverError.json | 252 +++++++++ .../bulkWrite-delete-hint-serverError.yml | 142 +++++ .../crud/unified/bulkWrite-delete-hint.json | 247 +++++++++ .../crud/unified/bulkWrite-delete-hint.yml | 154 ++++++ .../bulkWrite-update-hint-clientError.json | 151 ++++-- .../bulkWrite-update-hint-clientError.yml | 148 +++++ .../bulkWrite-update-hint-serverError.json | 422 ++++++++++++++ .../bulkWrite-update-hint-serverError.yml | 249 +++++++++ .../crud/unified/bulkWrite-update-hint.json | 445 +++++++++++++++ .../crud/unified/bulkWrite-update-hint.yml | 256 +++++++++ .../bulkWrite-update-validation.json | 121 +++-- .../unified/bulkWrite-update-validation.yml | 73 +++ test/spec/crud/unified/crud-let.json | 513 ------------------ test/spec/crud/unified/crud-let.yml | 221 -------- .../crud/{v2 => unified}/db-aggregate.json | 40 +- test/spec/crud/unified/db-aggregate.yml | 73 +++ .../unified/deleteMany-hint-clientError.json | 149 +++++ .../unified/deleteMany-hint-clientError.yml | 87 +++ .../unified/deleteMany-hint-serverError.json | 190 +++++++ .../unified/deleteMany-hint-serverError.yml | 107 ++++ test/spec/crud/unified/deleteMany-hint.json | 173 ++++++ test/spec/crud/unified/deleteMany-hint.yml | 99 ++++ .../unified/deleteOne-hint-clientError.json | 133 +++++ .../unified/deleteOne-hint-clientError.yml | 80 +++ .../unified/deleteOne-hint-serverError.json | 170 ++++++ .../unified/deleteOne-hint-serverError.yml | 100 ++++ test/spec/crud/unified/deleteOne-hint.json | 161 ++++++ test/spec/crud/unified/deleteOne-hint.yml | 95 ++++ .../find-allowdiskuse-clientError.json | 79 +++ .../unified/find-allowdiskuse-clientError.yml | 55 ++ .../find-allowdiskuse-serverError.json | 100 ++++ .../unified/find-allowdiskuse-serverError.yml | 68 +++ test/spec/crud/unified/find-allowdiskuse.json | 120 ++++ test/spec/crud/unified/find-allowdiskuse.yml | 79 +++ test/spec/crud/unified/find.json | 156 ++++++ test/spec/crud/unified/find.yml | 68 +++ .../findOneAndDelete-hint-clientError.json | 133 +++++ .../findOneAndDelete-hint-clientError.yml | 91 ++++ .../findOneAndDelete-hint-serverError.json | 162 ++++++ .../findOneAndDelete-hint-serverError.yml | 107 ++++ .../crud/unified/findOneAndDelete-hint.json | 155 ++++++ .../crud/unified/findOneAndDelete-hint.yml | 102 ++++ .../findOneAndReplace-hint-clientError.json | 139 +++++ .../findOneAndReplace-hint-clientError.yml | 83 +++ .../findOneAndReplace-hint-serverError.json | 172 ++++++ .../findOneAndReplace-hint-serverError.yml | 99 ++++ .../crud/unified/findOneAndReplace-hint.json | 173 ++++++ .../crud/unified/findOneAndReplace-hint.yml | 98 ++++ .../findOneAndUpdate-hint-clientError.json | 143 +++++ .../findOneAndUpdate-hint-clientError.yml | 84 +++ .../findOneAndUpdate-hint-serverError.json | 180 ++++++ .../findOneAndUpdate-hint-serverError.yml | 100 ++++ .../crud/unified/findOneAndUpdate-hint.json | 181 ++++++ .../crud/unified/findOneAndUpdate-hint.yml | 99 ++++ .../unified/insertMany-dots_and_dollars.json | 36 +- .../unified/insertMany-dots_and_dollars.yml | 4 +- .../unified/insertOne-dots_and_dollars.json | 44 +- .../unified/insertOne-dots_and_dollars.yml | 9 +- test/spec/crud/unified/replaceOne-hint.json | 203 +++++++ test/spec/crud/unified/replaceOne-hint.yml | 112 ++++ .../crud/unified/replaceOne-validation.json | 82 +++ .../crud/unified/replaceOne-validation.yml | 37 ++ ...ged-bulkWrite-delete-hint-clientError.json | 132 +++-- ...dged-bulkWrite-delete-hint-clientError.yml | 112 ++++ ...ged-bulkWrite-update-hint-clientError.json | 169 +++--- ...dged-bulkWrite-update-hint-clientError.yml | 147 +++++ ...nowledged-deleteMany-hint-clientError.json | 149 +++++ ...knowledged-deleteMany-hint-clientError.yml | 86 +++ ...knowledged-deleteOne-hint-clientError.json | 133 +++++ ...cknowledged-deleteOne-hint-clientError.yml | 79 +++ ...ged-findOneAndDelete-hint-clientError.json | 133 +++++ ...dged-findOneAndDelete-hint-clientError.yml | 90 +++ ...ed-findOneAndReplace-hint-clientError.json | 139 +++++ ...ged-findOneAndReplace-hint-clientError.yml | 82 +++ ...ged-findOneAndUpdate-hint-clientError.json | 143 +++++ ...dged-findOneAndUpdate-hint-clientError.yml | 83 +++ ...nowledged-replaceOne-hint-clientError.json | 143 +++++ ...knowledged-replaceOne-hint-clientError.yml | 83 +++ ...nowledged-updateMany-hint-clientError.json | 159 ++++++ ...knowledged-updateMany-hint-clientError.yml | 90 +++ ...knowledged-updateOne-hint-clientError.json | 147 +++++ ...cknowledged-updateOne-hint-clientError.yml | 84 +++ .../updateMany-hint-clientError.json | 95 +++- .../unified/updateMany-hint-clientError.yml | 91 ++++ .../unified/updateMany-hint-serverError.json | 216 ++++++++ .../unified/updateMany-hint-serverError.yml | 117 ++++ test/spec/crud/unified/updateMany-hint.json | 219 ++++++++ test/spec/crud/unified/updateMany-hint.yml | 117 ++++ .../crud/unified/updateMany-validation.json | 98 ++++ .../crud/unified/updateMany-validation.yml | 39 ++ .../unified/updateOne-hint-clientError.json | 147 +++++ .../unified/updateOne-hint-clientError.yml | 85 +++ .../unified/updateOne-hint-serverError.json | 208 +++++++ .../unified/updateOne-hint-serverError.yml | 113 ++++ test/spec/crud/unified/updateOne-hint.json | 211 +++++++ test/spec/crud/unified/updateOne-hint.yml | 113 ++++ .../crud/unified/updateOne-validation.json | 80 +++ .../crud/unified/updateOne-validation.yml | 37 ++ .../crud/unified/updateWithPipelines.json | 494 +++++++++++++++++ .../spec/crud/unified/updateWithPipelines.yml | 305 +++++++++++ .../crud/v1/read/aggregate-collation.json | 1 + .../spec/crud/v1/read/aggregate-collation.yml | 3 +- test/spec/crud/v1/read/aggregate-out.json | 1 + test/spec/crud/v1/read/aggregate-out.yml | 1 + test/spec/crud/v1/read/count-collation.json | 1 + test/spec/crud/v1/read/count-collation.yml | 3 +- .../spec/crud/v1/read/distinct-collation.json | 1 + test/spec/crud/v1/read/distinct-collation.yml | 3 +- test/spec/crud/v1/read/find-collation.json | 1 + test/spec/crud/v1/read/find-collation.yml | 3 +- .../crud/v1/write/bulkWrite-collation.json | 1 + .../crud/v1/write/bulkWrite-collation.yml | 3 +- .../crud/v1/write/deleteMany-collation.json | 1 + .../crud/v1/write/deleteMany-collation.yml | 3 +- .../crud/v1/write/deleteOne-collation.json | 1 + .../crud/v1/write/deleteOne-collation.yml | 3 +- .../v1/write/findOneAndDelete-collation.json | 1 + .../v1/write/findOneAndDelete-collation.yml | 5 +- .../v1/write/findOneAndReplace-collation.json | 1 + .../v1/write/findOneAndReplace-collation.yml | 3 +- .../v1/write/findOneAndUpdate-collation.json | 1 + .../v1/write/findOneAndUpdate-collation.yml | 5 +- .../crud/v1/write/replaceOne-collation.json | 1 + .../crud/v1/write/replaceOne-collation.yml | 5 +- .../crud/v1/write/updateMany-collation.json | 1 + .../crud/v1/write/updateMany-collation.yml | 3 +- .../crud/v1/write/updateOne-collation.json | 1 + .../crud/v1/write/updateOne-collation.yml | 3 +- test/spec/crud/v2/aggregate-merge.json | 415 -------------- test/spec/crud/v2/aggregate-merge.yml | 103 ---- .../crud/v2/aggregate-out-readConcern.json | 385 ------------- .../crud/v2/aggregate-out-readConcern.yml | 110 ---- .../v2/bulkWrite-arrayFilters-clientError.yml | 50 -- test/spec/crud/v2/bulkWrite-arrayFilters.json | 226 -------- test/spec/crud/v2/bulkWrite-arrayFilters.yml | 103 ---- .../v2/bulkWrite-delete-hint-clientError.yml | 63 --- .../v2/bulkWrite-delete-hint-serverError.json | 209 ------- .../v2/bulkWrite-delete-hint-serverError.yml | 92 ---- test/spec/crud/v2/bulkWrite-delete-hint.json | 204 ------- test/spec/crud/v2/bulkWrite-delete-hint.yml | 103 ---- .../v2/bulkWrite-update-hint-clientError.yml | 90 --- .../v2/bulkWrite-update-hint-serverError.json | 343 ------------ .../v2/bulkWrite-update-hint-serverError.yml | 147 ----- test/spec/crud/v2/bulkWrite-update-hint.json | 366 ------------- test/spec/crud/v2/bulkWrite-update-hint.yml | 164 ------ .../crud/v2/bulkWrite-update-validation.yml | 75 --- test/spec/crud/v2/db-aggregate.yml | 38 -- .../crud/v2/deleteMany-hint-clientError.json | 100 ---- .../crud/v2/deleteMany-hint-clientError.yml | 43 -- .../crud/v2/deleteMany-hint-serverError.json | 141 ----- .../crud/v2/deleteMany-hint-serverError.yml | 62 --- test/spec/crud/v2/deleteMany-hint.json | 128 ----- test/spec/crud/v2/deleteMany-hint.yml | 58 -- .../crud/v2/deleteOne-hint-clientError.json | 84 --- .../crud/v2/deleteOne-hint-clientError.yml | 41 -- .../crud/v2/deleteOne-hint-serverError.json | 121 ----- .../crud/v2/deleteOne-hint-serverError.yml | 60 -- test/spec/crud/v2/deleteOne-hint.json | 116 ---- test/spec/crud/v2/deleteOne-hint.yml | 57 -- .../v2/find-allowdiskuse-clientError.json | 40 -- .../crud/v2/find-allowdiskuse-clientError.yml | 28 - .../v2/find-allowdiskuse-serverError.json | 61 --- .../crud/v2/find-allowdiskuse-serverError.yml | 44 -- test/spec/crud/v2/find-allowdiskuse.json | 78 --- test/spec/crud/v2/find-allowdiskuse.yml | 50 -- .../v2/findOneAndDelete-hint-clientError.json | 84 --- .../v2/findOneAndDelete-hint-clientError.yml | 45 -- .../v2/findOneAndDelete-hint-serverError.json | 113 ---- .../v2/findOneAndDelete-hint-serverError.yml | 60 -- test/spec/crud/v2/findOneAndDelete-hint.json | 110 ---- test/spec/crud/v2/findOneAndDelete-hint.yml | 56 -- .../findOneAndReplace-hint-clientError.json | 90 --- .../v2/findOneAndReplace-hint-clientError.yml | 40 -- .../findOneAndReplace-hint-serverError.json | 123 ----- .../v2/findOneAndReplace-hint-serverError.yml | 59 -- test/spec/crud/v2/findOneAndReplace-hint.json | 128 ----- test/spec/crud/v2/findOneAndReplace-hint.yml | 55 -- .../v2/findOneAndUpdate-hint-clientError.json | 94 ---- .../v2/findOneAndUpdate-hint-clientError.yml | 40 -- .../v2/findOneAndUpdate-hint-serverError.json | 131 ----- .../v2/findOneAndUpdate-hint-serverError.yml | 58 -- test/spec/crud/v2/findOneAndUpdate-hint.json | 136 ----- test/spec/crud/v2/findOneAndUpdate-hint.yml | 55 -- test/spec/crud/v2/replaceOne-hint.json | 146 ----- test/spec/crud/v2/replaceOne-hint.yml | 61 --- test/spec/crud/v2/replaceOne-validation.json | 41 -- test/spec/crud/v2/replaceOne-validation.yml | 21 - ...dged-bulkWrite-delete-hint-clientError.yml | 60 -- ...dged-bulkWrite-update-hint-clientError.yml | 88 --- ...nowledged-deleteMany-hint-clientError.json | 105 ---- ...knowledged-deleteMany-hint-clientError.yml | 40 -- ...knowledged-deleteOne-hint-clientError.json | 89 --- ...cknowledged-deleteOne-hint-clientError.yml | 38 -- ...ged-findOneAndDelete-hint-clientError.json | 89 --- ...dged-findOneAndDelete-hint-clientError.yml | 42 -- ...ed-findOneAndReplace-hint-clientError.json | 95 ---- ...ged-findOneAndReplace-hint-clientError.yml | 40 -- ...ged-findOneAndUpdate-hint-clientError.json | 99 ---- ...dged-findOneAndUpdate-hint-clientError.yml | 40 -- ...nowledged-replaceOne-hint-clientError.json | 99 ---- ...knowledged-replaceOne-hint-clientError.yml | 40 -- ...nowledged-updateMany-hint-clientError.json | 115 ---- ...knowledged-updateMany-hint-clientError.yml | 43 -- ...knowledged-updateOne-hint-clientError.json | 103 ---- ...cknowledged-updateOne-hint-clientError.yml | 40 -- .../crud/v2/updateMany-hint-clientError.yml | 45 -- .../crud/v2/updateMany-hint-serverError.json | 161 ------ .../crud/v2/updateMany-hint-serverError.yml | 66 --- test/spec/crud/v2/updateMany-hint.json | 168 ------ test/spec/crud/v2/updateMany-hint.yml | 65 --- test/spec/crud/v2/updateMany-validation.json | 57 -- test/spec/crud/v2/updateMany-validation.yml | 25 - .../crud/v2/updateOne-hint-clientError.json | 98 ---- .../crud/v2/updateOne-hint-clientError.yml | 43 -- .../crud/v2/updateOne-hint-serverError.json | 147 ----- .../crud/v2/updateOne-hint-serverError.yml | 62 --- test/spec/crud/v2/updateOne-hint.json | 154 ------ test/spec/crud/v2/updateOne-hint.yml | 61 --- test/spec/crud/v2/updateOne-validation.json | 39 -- test/spec/crud/v2/updateOne-validation.yml | 21 - test/spec/crud/v2/updateWithPipelines.json | 408 -------------- test/spec/crud/v2/updateWithPipelines.yml | 157 ------ .../aggregate-serverErrors.json | 10 +- .../aggregate-serverErrors.yml | 10 +- test/spec/retryable-reads/aggregate.yml | 2 +- ...angeStreams-client.watch-serverErrors.json | 13 +- ...hangeStreams-client.watch-serverErrors.yml | 11 +- .../changeStreams-client.watch.json | 3 +- .../changeStreams-client.watch.yml | 1 + ...ngeStreams-db.coll.watch-serverErrors.json | 13 +- ...angeStreams-db.coll.watch-serverErrors.yml | 11 +- .../changeStreams-db.coll.watch.json | 3 +- .../changeStreams-db.coll.watch.yml | 1 + .../changeStreams-db.watch-serverErrors.json | 13 +- .../changeStreams-db.watch-serverErrors.yml | 11 +- .../changeStreams-db.watch.json | 3 +- .../changeStreams-db.watch.yml | 1 + .../retryable-reads/count-serverErrors.json | 10 +- .../retryable-reads/count-serverErrors.yml | 10 +- .../countDocuments-serverErrors.json | 10 +- .../countDocuments-serverErrors.yml | 10 +- .../distinct-serverErrors.json | 10 +- .../retryable-reads/distinct-serverErrors.yml | 10 +- ...timatedDocumentCount-serverErrors-4.9.json | 10 +- ...stimatedDocumentCount-serverErrors-4.9.yml | 10 +- ...atedDocumentCount-serverErrors-pre4.9.json | 10 +- ...matedDocumentCount-serverErrors-pre4.9.yml | 10 +- .../retryable-reads/find-serverErrors.json | 10 +- .../retryable-reads/find-serverErrors.yml | 10 +- .../retryable-reads/findOne-serverErrors.json | 10 +- .../retryable-reads/findOne-serverErrors.yml | 10 +- .../gridfs-download-serverErrors.json | 10 +- .../gridfs-download-serverErrors.yml | 10 +- .../gridfs-downloadByName-serverErrors.json | 10 +- .../gridfs-downloadByName-serverErrors.yml | 12 +- .../listCollectionNames-serverErrors.json | 10 +- .../listCollectionNames-serverErrors.yml | 10 +- .../listCollectionObjects-serverErrors.json | 10 +- .../listCollectionObjects-serverErrors.yml | 14 +- .../retryable-reads/listCollectionObjects.yml | 4 + .../listCollections-serverErrors.json | 10 +- .../listCollections-serverErrors.yml | 10 +- .../listDatabaseNames-serverErrors.json | 10 +- .../listDatabaseNames-serverErrors.yml | 10 +- .../listDatabaseObjects-serverErrors.json | 10 +- .../listDatabaseObjects-serverErrors.yml | 14 +- .../retryable-reads/listDatabaseObjects.yml | 4 + .../listDatabases-serverErrors.json | 10 +- .../listDatabases-serverErrors.yml | 10 +- .../listIndexNames-serverErrors.json | 10 +- .../listIndexNames-serverErrors.yml | 10 +- .../listIndexes-serverErrors.json | 10 +- .../listIndexes-serverErrors.yml | 10 +- test/spec/retryable-reads/mapReduce.json | 3 +- test/spec/retryable-reads/mapReduce.yml | 2 + .../transactions/legacy/error-labels.json | 3 +- .../spec/transactions/legacy/error-labels.yml | 3 + .../legacy/mongos-pin-auto-tests.py | 3 + .../transactions/legacy/mongos-pin-auto.json | 3 +- .../transactions/legacy/mongos-pin-auto.yml | 3 + .../legacy/mongos-recovery-token.json | 3 +- .../legacy/mongos-recovery-token.yml | 2 + test/spec/transactions/legacy/pin-mongos.json | 3 +- test/spec/transactions/legacy/pin-mongos.yml | 3 + .../transactions/unified/mongos-unpin.json | 12 +- .../transactions/unified/mongos-unpin.yml | 10 +- .../expectedEvent-additionalProperties.json | 32 -- .../expectedEvent-additionalProperties.yml | 17 - ...t-commandFailedEvent-commandName-type.json | 34 -- ...nt-commandFailedEvent-commandName-type.yml | 18 - ...mandStartedEvent-additionalProperties.json | 34 -- ...mmandStartedEvent-additionalProperties.yml | 18 - ...vent-commandStartedEvent-command-type.json | 34 -- ...Event-commandStartedEvent-command-type.yml | 18 - ...-commandStartedEvent-commandName-type.json | 34 -- ...t-commandStartedEvent-commandName-type.yml | 18 - ...commandStartedEvent-databaseName-type.json | 34 -- ...-commandStartedEvent-databaseName-type.yml | 18 - ...ommandSucceededEvent-commandName-type.json | 34 -- ...commandSucceededEvent-commandName-type.yml | 18 - ...vent-commandSucceededEvent-reply-type.json | 34 -- ...Event-commandSucceededEvent-reply-type.yml | 18 - .../invalid/expectedEvent-maxProperties.json | 33 -- .../invalid/expectedEvent-maxProperties.yml | 18 - .../invalid/expectedEvent-minProperties.json | 30 - .../invalid/expectedEvent-minProperties.yml | 17 - .../runOnRequirement-serverless-enum.json | 15 + .../runOnRequirement-serverless-enum.yml | 10 + .../runOnRequirement-serverless-type.json | 15 + .../runOnRequirement-serverless-type.yml | 10 + .../valid-pass/poc-crud.json | 450 +++++++++++++++ .../valid-pass/poc-crud.yml | 190 +++++++ .../valid-pass/poc-retryable-writes.json | 3 - .../valid-pass/poc-retryable-writes.yml | 5 +- 331 files changed, 16364 insertions(+), 11231 deletions(-) create mode 100644 test/spec/crud/unified/aggregate-merge.json create mode 100644 test/spec/crud/unified/aggregate-merge.yml create mode 100644 test/spec/crud/unified/aggregate-out-readConcern.json create mode 100644 test/spec/crud/unified/aggregate-out-readConcern.yml create mode 100644 test/spec/crud/unified/aggregate.json create mode 100644 test/spec/crud/unified/aggregate.yml rename test/spec/crud/{v2 => unified}/bulkWrite-arrayFilters-clientError.json (53%) create mode 100644 test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml create mode 100644 test/spec/crud/unified/bulkWrite-arrayFilters.json create mode 100644 test/spec/crud/unified/bulkWrite-arrayFilters.yml rename test/spec/crud/{v2 => unified}/bulkWrite-delete-hint-clientError.json (54%) create mode 100644 test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml create mode 100644 test/spec/crud/unified/bulkWrite-delete-hint-serverError.json create mode 100644 test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml create mode 100644 test/spec/crud/unified/bulkWrite-delete-hint.json create mode 100644 test/spec/crud/unified/bulkWrite-delete-hint.yml rename test/spec/crud/{v2 => unified}/bulkWrite-update-hint-clientError.json (63%) create mode 100644 test/spec/crud/unified/bulkWrite-update-hint-clientError.yml create mode 100644 test/spec/crud/unified/bulkWrite-update-hint-serverError.json create mode 100644 test/spec/crud/unified/bulkWrite-update-hint-serverError.yml create mode 100644 test/spec/crud/unified/bulkWrite-update-hint.json create mode 100644 test/spec/crud/unified/bulkWrite-update-hint.yml rename test/spec/crud/{v2 => unified}/bulkWrite-update-validation.json (54%) create mode 100644 test/spec/crud/unified/bulkWrite-update-validation.yml delete mode 100644 test/spec/crud/unified/crud-let.json delete mode 100644 test/spec/crud/unified/crud-let.yml rename test/spec/crud/{v2 => unified}/db-aggregate.json (68%) create mode 100644 test/spec/crud/unified/db-aggregate.yml create mode 100644 test/spec/crud/unified/deleteMany-hint-clientError.json create mode 100644 test/spec/crud/unified/deleteMany-hint-clientError.yml create mode 100644 test/spec/crud/unified/deleteMany-hint-serverError.json create mode 100644 test/spec/crud/unified/deleteMany-hint-serverError.yml create mode 100644 test/spec/crud/unified/deleteMany-hint.json create mode 100644 test/spec/crud/unified/deleteMany-hint.yml create mode 100644 test/spec/crud/unified/deleteOne-hint-clientError.json create mode 100644 test/spec/crud/unified/deleteOne-hint-clientError.yml create mode 100644 test/spec/crud/unified/deleteOne-hint-serverError.json create mode 100644 test/spec/crud/unified/deleteOne-hint-serverError.yml create mode 100644 test/spec/crud/unified/deleteOne-hint.json create mode 100644 test/spec/crud/unified/deleteOne-hint.yml create mode 100644 test/spec/crud/unified/find-allowdiskuse-clientError.json create mode 100644 test/spec/crud/unified/find-allowdiskuse-clientError.yml create mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.json create mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.yml create mode 100644 test/spec/crud/unified/find-allowdiskuse.json create mode 100644 test/spec/crud/unified/find-allowdiskuse.yml create mode 100644 test/spec/crud/unified/find.json create mode 100644 test/spec/crud/unified/find.yml create mode 100644 test/spec/crud/unified/findOneAndDelete-hint-clientError.json create mode 100644 test/spec/crud/unified/findOneAndDelete-hint-clientError.yml create mode 100644 test/spec/crud/unified/findOneAndDelete-hint-serverError.json create mode 100644 test/spec/crud/unified/findOneAndDelete-hint-serverError.yml create mode 100644 test/spec/crud/unified/findOneAndDelete-hint.json create mode 100644 test/spec/crud/unified/findOneAndDelete-hint.yml create mode 100644 test/spec/crud/unified/findOneAndReplace-hint-clientError.json create mode 100644 test/spec/crud/unified/findOneAndReplace-hint-clientError.yml create mode 100644 test/spec/crud/unified/findOneAndReplace-hint-serverError.json create mode 100644 test/spec/crud/unified/findOneAndReplace-hint-serverError.yml create mode 100644 test/spec/crud/unified/findOneAndReplace-hint.json create mode 100644 test/spec/crud/unified/findOneAndReplace-hint.yml create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint-clientError.json create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint-serverError.json create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint.json create mode 100644 test/spec/crud/unified/findOneAndUpdate-hint.yml create mode 100644 test/spec/crud/unified/replaceOne-hint.json create mode 100644 test/spec/crud/unified/replaceOne-hint.yml create mode 100644 test/spec/crud/unified/replaceOne-validation.json create mode 100644 test/spec/crud/unified/replaceOne-validation.yml rename test/spec/crud/{v2 => unified}/unacknowledged-bulkWrite-delete-hint-clientError.json (53%) create mode 100644 test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml rename test/spec/crud/{v2 => unified}/unacknowledged-bulkWrite-update-hint-clientError.json (62%) create mode 100644 test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml create mode 100644 test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json create mode 100644 test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml rename test/spec/crud/{v2 => unified}/updateMany-hint-clientError.json (50%) create mode 100644 test/spec/crud/unified/updateMany-hint-clientError.yml create mode 100644 test/spec/crud/unified/updateMany-hint-serverError.json create mode 100644 test/spec/crud/unified/updateMany-hint-serverError.yml create mode 100644 test/spec/crud/unified/updateMany-hint.json create mode 100644 test/spec/crud/unified/updateMany-hint.yml create mode 100644 test/spec/crud/unified/updateMany-validation.json create mode 100644 test/spec/crud/unified/updateMany-validation.yml create mode 100644 test/spec/crud/unified/updateOne-hint-clientError.json create mode 100644 test/spec/crud/unified/updateOne-hint-clientError.yml create mode 100644 test/spec/crud/unified/updateOne-hint-serverError.json create mode 100644 test/spec/crud/unified/updateOne-hint-serverError.yml create mode 100644 test/spec/crud/unified/updateOne-hint.json create mode 100644 test/spec/crud/unified/updateOne-hint.yml create mode 100644 test/spec/crud/unified/updateOne-validation.json create mode 100644 test/spec/crud/unified/updateOne-validation.yml create mode 100644 test/spec/crud/unified/updateWithPipelines.json create mode 100644 test/spec/crud/unified/updateWithPipelines.yml delete mode 100644 test/spec/crud/v2/aggregate-merge.json delete mode 100644 test/spec/crud/v2/aggregate-merge.yml delete mode 100644 test/spec/crud/v2/aggregate-out-readConcern.json delete mode 100644 test/spec/crud/v2/aggregate-out-readConcern.yml delete mode 100644 test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml delete mode 100644 test/spec/crud/v2/bulkWrite-arrayFilters.json delete mode 100644 test/spec/crud/v2/bulkWrite-arrayFilters.yml delete mode 100644 test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml delete mode 100644 test/spec/crud/v2/bulkWrite-delete-hint-serverError.json delete mode 100644 test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml delete mode 100644 test/spec/crud/v2/bulkWrite-delete-hint.json delete mode 100644 test/spec/crud/v2/bulkWrite-delete-hint.yml delete mode 100644 test/spec/crud/v2/bulkWrite-update-hint-clientError.yml delete mode 100644 test/spec/crud/v2/bulkWrite-update-hint-serverError.json delete mode 100644 test/spec/crud/v2/bulkWrite-update-hint-serverError.yml delete mode 100644 test/spec/crud/v2/bulkWrite-update-hint.json delete mode 100644 test/spec/crud/v2/bulkWrite-update-hint.yml delete mode 100644 test/spec/crud/v2/bulkWrite-update-validation.yml delete mode 100644 test/spec/crud/v2/db-aggregate.yml delete mode 100644 test/spec/crud/v2/deleteMany-hint-clientError.json delete mode 100644 test/spec/crud/v2/deleteMany-hint-clientError.yml delete mode 100644 test/spec/crud/v2/deleteMany-hint-serverError.json delete mode 100644 test/spec/crud/v2/deleteMany-hint-serverError.yml delete mode 100644 test/spec/crud/v2/deleteMany-hint.json delete mode 100644 test/spec/crud/v2/deleteMany-hint.yml delete mode 100644 test/spec/crud/v2/deleteOne-hint-clientError.json delete mode 100644 test/spec/crud/v2/deleteOne-hint-clientError.yml delete mode 100644 test/spec/crud/v2/deleteOne-hint-serverError.json delete mode 100644 test/spec/crud/v2/deleteOne-hint-serverError.yml delete mode 100644 test/spec/crud/v2/deleteOne-hint.json delete mode 100644 test/spec/crud/v2/deleteOne-hint.yml delete mode 100644 test/spec/crud/v2/find-allowdiskuse-clientError.json delete mode 100644 test/spec/crud/v2/find-allowdiskuse-clientError.yml delete mode 100644 test/spec/crud/v2/find-allowdiskuse-serverError.json delete mode 100644 test/spec/crud/v2/find-allowdiskuse-serverError.yml delete mode 100644 test/spec/crud/v2/find-allowdiskuse.json delete mode 100644 test/spec/crud/v2/find-allowdiskuse.yml delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint-clientError.json delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint-clientError.yml delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint-serverError.json delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint-serverError.yml delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint.json delete mode 100644 test/spec/crud/v2/findOneAndDelete-hint.yml delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint-clientError.json delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint-clientError.yml delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint-serverError.json delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint-serverError.yml delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint.json delete mode 100644 test/spec/crud/v2/findOneAndReplace-hint.yml delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint-clientError.json delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint-serverError.json delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint.json delete mode 100644 test/spec/crud/v2/findOneAndUpdate-hint.yml delete mode 100644 test/spec/crud/v2/replaceOne-hint.json delete mode 100644 test/spec/crud/v2/replaceOne-hint.yml delete mode 100644 test/spec/crud/v2/replaceOne-validation.json delete mode 100644 test/spec/crud/v2/replaceOne-validation.yml delete mode 100644 test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml delete mode 100644 test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json delete mode 100644 test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml delete mode 100644 test/spec/crud/v2/updateMany-hint-clientError.yml delete mode 100644 test/spec/crud/v2/updateMany-hint-serverError.json delete mode 100644 test/spec/crud/v2/updateMany-hint-serverError.yml delete mode 100644 test/spec/crud/v2/updateMany-hint.json delete mode 100644 test/spec/crud/v2/updateMany-hint.yml delete mode 100644 test/spec/crud/v2/updateMany-validation.json delete mode 100644 test/spec/crud/v2/updateMany-validation.yml delete mode 100644 test/spec/crud/v2/updateOne-hint-clientError.json delete mode 100644 test/spec/crud/v2/updateOne-hint-clientError.yml delete mode 100644 test/spec/crud/v2/updateOne-hint-serverError.json delete mode 100644 test/spec/crud/v2/updateOne-hint-serverError.yml delete mode 100644 test/spec/crud/v2/updateOne-hint.json delete mode 100644 test/spec/crud/v2/updateOne-hint.yml delete mode 100644 test/spec/crud/v2/updateOne-validation.json delete mode 100644 test/spec/crud/v2/updateOne-validation.yml delete mode 100644 test/spec/crud/v2/updateWithPipelines.json delete mode 100644 test/spec/crud/v2/updateWithPipelines.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-minProperties.json delete mode 100644 test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json create mode 100644 test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml create mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.json create mode 100644 test/spec/unified-test-format/valid-pass/poc-crud.yml diff --git a/src/collection.ts b/src/collection.ts index efd5d8db66a..3b83e81f440 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1237,11 +1237,11 @@ export class Collection { * @param callback - An optional callback, a Promise will be returned if none is provided */ findOneAndDelete(filter: Filter): Promise>; - findOneAndDelete(filter: Filter, callback: Callback>): void; findOneAndDelete( filter: Filter, options: FindOneAndDeleteOptions ): Promise>; + findOneAndDelete(filter: Filter, callback: Callback>): void; findOneAndDelete( filter: Filter, options: FindOneAndDeleteOptions, diff --git a/test/functional/crud_spec.test.js b/test/functional/crud_spec.test.js index 14c4da4244a..2cda5ac4b22 100644 --- a/test/functional/crud_spec.test.js +++ b/test/functional/crud_spec.test.js @@ -6,10 +6,6 @@ const chai = require('chai'); const expect = chai.expect; chai.use(require('chai-subset')); -const TestRunnerContext = require('./spec-runner').TestRunnerContext; -const gatherTestSuites = require('./spec-runner').gatherTestSuites; -const generateTopologyTests = require('./spec-runner').generateTopologyTests; - const { loadSpecTests } = require('../spec/index'); const { runUnifiedTest } = require('./unified-spec-runner/runner'); @@ -425,17 +421,6 @@ describe('CRUD spec', function () { } }); -describe('CRUD v2', function () { - const testContext = new TestRunnerContext(); - const testSuites = gatherTestSuites(path.resolve(__dirname, '../spec/crud/v2')); - after(() => testContext.teardown()); - before(function () { - return testContext.setup(this.configuration); - }); - - generateTopologyTests(testSuites, testContext); -}); - describe('CRUD unified', function () { for (const crudSpecTest of loadSpecTests('crud/unified')) { expect(crudSpecTest).to.exist; diff --git a/test/functional/unified-spec-runner/operations.ts b/test/functional/unified-spec-runner/operations.ts index 16ac952f883..42baf39e6bd 100644 --- a/test/functional/unified-spec-runner/operations.ts +++ b/test/functional/unified-spec-runner/operations.ts @@ -270,6 +270,12 @@ operations.set('findOneAndUpdate', async ({ entities, operation }) => { return (await collection.findOneAndUpdate(filter, update, translateOptions(opts))).value; }); +operations.set('findOneAndDelete', async ({ entities, operation }) => { + const collection = entities.getEntity('collection', operation.object); + const { filter, ...opts } = operation.arguments; + return (await collection.findOneAndDelete(filter, opts)).value; +}); + operations.set('failPoint', async ({ entities, operation }) => { const client = entities.getEntity('client', operation.arguments.client); return entities.failPoints.enableFailPoint(client, operation.arguments.failPoint); @@ -409,12 +415,6 @@ operations.set('estimatedDocumentCount', async ({ entities, operation }) => { return collection.estimatedDocumentCount(operation.arguments); }); -operations.set('findOneAndDelete', async ({ entities, operation }) => { - const collection = entities.getEntity('collection', operation.object); - const { filter, ...opts } = operation.arguments; - return collection.findOneAndDelete(filter, opts); -}); - operations.set('runCommand', async ({ entities, operation }: OperationFunctionParams) => { const db = entities.getEntity('db', operation.object); const { command, ...opts } = operation.arguments; diff --git a/test/spec/crud/unified/aggregate-let.json b/test/spec/crud/unified/aggregate-let.json index b031b64cf07..d3b76bd65a1 100644 --- a/test/spec/crud/unified/aggregate-let.json +++ b/test/spec/crud/unified/aggregate-let.json @@ -1,6 +1,6 @@ { "description": "aggregate-let", - "schemaVersion": "1.0", + "schemaVersion": "1.4", "createEntities": [ { "client": { @@ -23,6 +23,13 @@ "database": "database0", "collectionName": "coll0" } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } } ], "initialData": [ @@ -34,6 +41,11 @@ "_id": 1 } ] + }, + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [] } ], "tests": [ @@ -293,6 +305,175 @@ ] } ] + }, + { + "description": "Aggregate to collection with let option", + "runOnRequirements": [ + { + "minServerVersion": "5.0", + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + } + ] + } + ] + }, + { + "description": "Aggregate to collection with let option unsupported (server-side error)", + "runOnRequirements": [ + { + "minServerVersion": "2.6.0", + "maxServerVersion": "4.4.99" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + }, + "expectError": { + "errorContains": "unrecognized field 'let'", + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "$expr": { + "$eq": [ + "$_id", + "$$id" + ] + } + } + }, + { + "$project": { + "_id": 1 + } + }, + { + "$out": "coll1" + } + ], + "let": { + "id": 1 + } + } + } + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/aggregate-let.yml b/test/spec/crud/unified/aggregate-let.yml index ef6ce1558e7..80da3d90b3c 100644 --- a/test/spec/crud/unified/aggregate-let.yml +++ b/test/spec/crud/unified/aggregate-let.yml @@ -1,6 +1,6 @@ description: "aggregate-let" -schemaVersion: "1.0" +schemaVersion: "1.4" createEntities: - client: @@ -14,12 +14,19 @@ createEntities: id: &collection0 collection0 database: *database0 collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 initialData: &initialData - collectionName: *collection0Name databaseName: *database0Name documents: - { _id: 1 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: [ ] tests: # TODO: Once SERVER-57403 is resolved, this test can be removed in favor of @@ -115,3 +122,53 @@ tests: aggregate: *collection0Name pipeline: *pipeline1 let: *let1 + + - description: "Aggregate to collection with let option" + runOnRequirements: + - minServerVersion: "5.0" + serverless: "forbid" + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: &pipeline2 + - $match: { $expr: { $eq: ["$_id", "$$id"] } } + - $project: { _id: 1 } + - $out: *collection1Name + let: &let2 + id: 1 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: *pipeline2 + let: *let2 + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1 } + + - description: "Aggregate to collection with let option unsupported (server-side error)" + runOnRequirements: + - minServerVersion: "2.6.0" + maxServerVersion: "4.4.99" + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: *pipeline2 + let: *let2 + expectError: + errorContains: "unrecognized field 'let'" + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: *pipeline2 + let: *let2 diff --git a/test/spec/crud/unified/aggregate-merge.json b/test/spec/crud/unified/aggregate-merge.json new file mode 100644 index 00000000000..ac61ceb8a6f --- /dev/null +++ b/test/spec/crud/unified/aggregate-merge.json @@ -0,0 +1,497 @@ +{ + "description": "aggregate-merge", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.1.11" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_aggregate_merge" + } + }, + { + "collection": { + "id": "collection_readConcern_majority", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_local", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "local" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_available", + "database": "database0", + "collectionName": "test_aggregate_merge", + "collectionOptions": { + "readConcern": { + "level": "available" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "test_aggregate_merge", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Aggregate with $merge", + "operations": [ + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and batch size of 0", + "operations": [ + { + "object": "collection0", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "batchSize": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "cursor": {} + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and majority readConcern", + "operations": [ + { + "object": "collection_readConcern_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "majority" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and local readConcern", + "operations": [ + { + "object": "collection_readConcern_local", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "local" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $merge and available readConcern", + "operations": [ + { + "object": "collection_readConcern_available", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_merge", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$merge": { + "into": "other_test_collection" + } + } + ], + "readConcern": { + "level": "available" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/aggregate-merge.yml b/test/spec/crud/unified/aggregate-merge.yml new file mode 100644 index 00000000000..821f03e1c64 --- /dev/null +++ b/test/spec/crud/unified/aggregate-merge.yml @@ -0,0 +1,185 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: aggregate-merge +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.1.11 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_aggregate_merge + - + collection: + id: &collection_readConcern_majority collection_readConcern_majority + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "majority" } + - + collection: + id: &collection_readConcern_local collection_readConcern_local + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "local" } + - + collection: + id: &collection_readConcern_available collection_readConcern_available + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "available" } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Aggregate with $merge' + operations: + - + object: *collection0 + name: aggregate + arguments: &arguments + pipeline: &pipeline + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $merge: + into: &output_collection other_test_collection + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + outcome: &outcome + - + collectionName: *output_collection + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Aggregate with $merge and batch size of 0' + operations: + - + object: *collection0 + name: aggregate + arguments: + pipeline: &pipeline + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $merge: + into: &output_collection other_test_collection + batchSize: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + cursor: { } + outcome: *outcome + - + description: 'Aggregate with $merge and majority readConcern' + operations: + - + object: *collection_readConcern_majority + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: majority + outcome: *outcome + - + description: 'Aggregate with $merge and local readConcern' + operations: + - + object: *collection_readConcern_local + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: local + outcome: *outcome + - + description: 'Aggregate with $merge and available readConcern' + operations: + - + object: *collection_readConcern_available + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: available + outcome: *outcome diff --git a/test/spec/crud/unified/aggregate-out-readConcern.json b/test/spec/crud/unified/aggregate-out-readConcern.json new file mode 100644 index 00000000000..e293457c1c7 --- /dev/null +++ b/test/spec/crud/unified/aggregate-out-readConcern.json @@ -0,0 +1,407 @@ +{ + "description": "aggregate-out-readConcern", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "minServerVersion": "4.1.0", + "topologies": [ + "replicaset", + "sharded" + ], + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern" + } + }, + { + "collection": { + "id": "collection_readConcern_majority", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_local", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "local" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_available", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "available" + } + } + } + }, + { + "collection": { + "id": "collection_readConcern_linearizable", + "database": "database0", + "collectionName": "test_aggregate_out_readconcern", + "collectionOptions": { + "readConcern": { + "level": "linearizable" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "test_aggregate_out_readconcern", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "readConcern majority with out stage", + "operations": [ + { + "object": "collection_readConcern_majority", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "majority" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern local with out stage", + "operations": [ + { + "object": "collection_readConcern_local", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "local" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern available with out stage", + "operations": [ + { + "object": "collection_readConcern_available", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "available" + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "other_test_collection", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "readConcern linearizable with out stage", + "operations": [ + { + "object": "collection_readConcern_linearizable", + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ] + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "test_aggregate_out_readconcern", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "other_test_collection" + } + ], + "readConcern": { + "level": "linearizable" + } + } + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/aggregate-out-readConcern.yml b/test/spec/crud/unified/aggregate-out-readConcern.yml new file mode 100644 index 00000000000..c210c469297 --- /dev/null +++ b/test/spec/crud/unified/aggregate-out-readConcern.yml @@ -0,0 +1,171 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: aggregate-out-readConcern +schemaVersion: '1.4' +runOnRequirements: + - + minServerVersion: 4.1.0 + topologies: + - replicaset + - sharded + serverless: "forbid" +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_aggregate_out_readconcern + - + collection: + id: &collection_readConcern_majority collection_readConcern_majority + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "majority" } + - + collection: + id: &collection_readConcern_local collection_readConcern_local + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "local" } + - + collection: + id: &collection_readConcern_available collection_readConcern_available + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "available" } + - + collection: + id: &collection_readConcern_linearizable collection_readConcern_linearizable + database: database0 + collectionName: *collection_name + collectionOptions: + readConcern: { level: "linearizable" } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'readConcern majority with out stage' + operations: + - + object: *collection_readConcern_majority + name: aggregate + arguments: &arguments + pipeline: + - + $sort: + x: 1 + - + $match: + _id: + $gt: 1 + - + $out: &output_collection other_test_collection + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: &pipeline + - { $sort: { x: 1 } } + - { $match: { _id: { $gt: 1 } } } + - { $out: other_test_collection } + readConcern: + level: majority + outcome: &outcome + - + collectionName: *output_collection + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'readConcern local with out stage' + operations: + - + object: *collection_readConcern_local + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: local + outcome: *outcome + - + description: 'readConcern available with out stage' + operations: + - + object: *collection_readConcern_available + name: aggregate + arguments: *arguments + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: available + outcome: *outcome + - + description: 'readConcern linearizable with out stage' + operations: + - + object: *collection_readConcern_linearizable + name: aggregate + arguments: *arguments + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + aggregate: *collection_name + pipeline: *pipeline + readConcern: + level: linearizable diff --git a/test/spec/crud/unified/aggregate.json b/test/spec/crud/unified/aggregate.json new file mode 100644 index 00000000000..dcdad761e8e --- /dev/null +++ b/test/spec/crud/unified/aggregate.json @@ -0,0 +1,166 @@ +{ + "description": "aggregate", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "aggregate-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "aggregate-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "tests": [ + { + "description": "aggregate with multiple batches works", + "operations": [ + { + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "batchSize": 2 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "cursor": { + "batchSize": 2 + } + }, + "commandName": "aggregate", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/aggregate.yml b/test/spec/crud/unified/aggregate.yml new file mode 100644 index 00000000000..248b91cefb2 --- /dev/null +++ b/test/spec/crud/unified/aggregate.yml @@ -0,0 +1,68 @@ +description: "aggregate" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name aggregate-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + +tests: + - description: "aggregate with multiple batches works" + operations: + - name: aggregate + arguments: + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + batchSize: 2 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + cursor: { batchSize: 2 } + commandName: aggregate + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + diff --git a/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json similarity index 53% rename from test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json rename to test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json index 22e22f0efb1..63815e32337 100644 --- a/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.json +++ b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.json @@ -1,29 +1,61 @@ { - "runOn": [ + "description": "bulkWrite-arrayFilters-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.5.5" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "y": [ + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "crud-v2" + } + } + ], + "initialData": [ + { + "collectionName": "crud-v2", + "databaseName": "crud-v2", + "documents": [ { - "b": 0 + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] }, { - "b": 1 + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] } ] } @@ -33,12 +65,12 @@ "description": "BulkWrite on server that doesn't support arrayFilters", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": {}, "update": { "$set": { @@ -53,25 +85,30 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [] + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] }, { "description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": {}, "update": { "$set": { @@ -81,8 +118,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": {}, "update": { "$set": { @@ -97,14 +133,19 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [] + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml new file mode 100644 index 00000000000..8b4c7a1c9e4 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-arrayFilters-clientError.yml @@ -0,0 +1,98 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-arrayFilters-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.5.5 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name crud-v2 +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 +tests: + - + description: 'BulkWrite on server that doesn''t support arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + y.0.b: 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + - + description: 'BulkWrite on server that doesn''t support arrayFilters with arrayFilters on second op' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + y.0.b: 2 + - + updateMany: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] diff --git a/test/spec/crud/unified/bulkWrite-arrayFilters.json b/test/spec/crud/unified/bulkWrite-arrayFilters.json new file mode 100644 index 00000000000..70ee014f7ad --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-arrayFilters.json @@ -0,0 +1,279 @@ +{ + "description": "bulkWrite-arrayFilters", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.5.6" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with arrayFilters", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": { + "$set": { + "y.$[i].b": 2 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "arrayFilters": [ + { + "i.b": 3 + } + ] + } + ], + "ordered": true + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 2 + }, + { + "b": 1 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 1 + } + ] + } + ] + } + ] + }, + { + "description": "BulkWrite updateMany with arrayFilters", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": {}, + "update": { + "$set": { + "y.$[i].b": 2 + } + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": { + "$set": { + "y.$[i].b": 2 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "arrayFilters": [ + { + "i.b": 1 + } + ] + } + ], + "ordered": true + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "y": [ + { + "b": 3 + }, + { + "b": 2 + } + ] + }, + { + "_id": 2, + "y": [ + { + "b": 0 + }, + { + "b": 2 + } + ] + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/bulkWrite-arrayFilters.yml b/test/spec/crud/unified/bulkWrite-arrayFilters.yml new file mode 100644 index 00000000000..a236acb12d6 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-arrayFilters.yml @@ -0,0 +1,174 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-arrayFilters +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.5.6 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-tests + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 +tests: + - + description: 'BulkWrite updateOne with arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 3 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + $set: { 'y.$[i].b': 2 } + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + arrayFilters: + - { i.b: 3 } + ordered: true + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 2 + - + b: 1 + - + _id: 2 + 'y': + - + b: 0 + - + b: 1 + - + description: 'BulkWrite updateMany with arrayFilters' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: { } + update: + $set: + 'y.$[i].b': 2 + arrayFilters: + - + i.b: 1 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + $set: { 'y.$[i].b': 2 } + multi: true + upsert: { $$unsetOrMatches: false } + arrayFilters: + - { i.b: 1 } + ordered: true + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + 'y': + - + b: 3 + - + b: 2 + - + _id: 2 + 'y': + - + b: 0 + - + b: 2 diff --git a/test/spec/crud/v2/bulkWrite-delete-hint-clientError.json b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.json similarity index 54% rename from test/spec/crud/v2/bulkWrite-delete-hint-clientError.json rename to test/spec/crud/unified/bulkWrite-delete-hint-clientError.json index cfeac904ca1..2961b55dc05 100644 --- a/test/spec/crud/v2/bulkWrite-delete-hint-clientError.json +++ b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.json @@ -1,39 +1,70 @@ { - "runOn": [ + "description": "bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] } ], - "collection_name": "BulkWrite_delete_hint", "tests": [ { "description": "BulkWrite deleteOne with hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 1 }, @@ -41,8 +72,7 @@ } }, { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 2 }, @@ -52,17 +82,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -81,18 +118,18 @@ } ] } - } + ] }, { "description": "BulkWrite deleteMany with hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$lt": 3 @@ -102,8 +139,7 @@ } }, { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$gte": 4 @@ -115,17 +151,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -144,7 +187,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml new file mode 100644 index 00000000000..2b0bdb1c21b --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-delete-hint-clientError.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite deleteMany with hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/bulkWrite-delete-hint-serverError.json b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.json new file mode 100644 index 00000000000..fa995220935 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.json @@ -0,0 +1,252 @@ +{ + "description": "bulkWrite-delete-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite deleteOne with hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + }, + { + "q": { + "_id": 2 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite deleteMany with hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_", + "limit": 0 + }, + { + "q": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml new file mode 100644 index 00000000000..e757bade0ca --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-delete-hint-serverError.yml @@ -0,0 +1,142 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteOne_filter1 + hint: *hint_string + limit: 1 + - + q: *deleteOne_filter2 + hint: *hint_doc + limit: 1 + ordered: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite deleteMany with hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteMany_filter1 + hint: *hint_string + limit: 0 + - + q: *deleteMany_filter2 + hint: *hint_doc + limit: 0 + ordered: true + outcome: *outcome diff --git a/test/spec/crud/unified/bulkWrite-delete-hint.json b/test/spec/crud/unified/bulkWrite-delete-hint.json new file mode 100644 index 00000000000..9fcdecefd70 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-delete-hint.json @@ -0,0 +1,247 @@ +{ + "description": "bulkWrite-delete-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite deleteOne with hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + } + }, + { + "deleteOne": { + "filter": { + "_id": 2 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 2, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + }, + { + "q": { + "_id": 2 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite deleteMany with hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_" + } + }, + { + "deleteMany": { + "filter": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 3, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "BulkWrite_delete_hint", + "deletes": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "hint": "_id_", + "limit": 0 + }, + { + "q": { + "_id": { + "$gte": 4 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/bulkWrite-delete-hint.yml b/test/spec/crud/unified/bulkWrite-delete-hint.yml new file mode 100644 index 00000000000..8b7f84aa94c --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-delete-hint.yml @@ -0,0 +1,154 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-delete-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite deleteOne with hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectResult: + deletedCount: 2 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteOne_filter1 + hint: *hint_string + limit: 1 + - + q: *deleteOne_filter2 + hint: *hint_doc + limit: 1 + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite deleteMany with hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 3 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *deleteMany_filter1 + hint: *hint_string + limit: 0 + - + q: *deleteMany_filter2 + hint: *hint_doc + limit: 0 + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 3 + x: 33 diff --git a/test/spec/crud/v2/bulkWrite-update-hint-clientError.json b/test/spec/crud/unified/bulkWrite-update-hint-clientError.json similarity index 63% rename from test/spec/crud/v2/bulkWrite-update-hint-clientError.json rename to test/spec/crud/unified/bulkWrite-update-hint-clientError.json index fa919ec5150..d5eb71c29e8 100644 --- a/test/spec/crud/v2/bulkWrite-update-hint-clientError.json +++ b/test/spec/crud/unified/bulkWrite-update-hint-clientError.json @@ -1,39 +1,70 @@ { - "runOn": [ + "description": "bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] } ], - "collection_name": "test_bulkwrite_update_hint", "tests": [ { "description": "BulkWrite updateOne with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -46,8 +77,7 @@ } }, { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -62,17 +92,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -91,18 +128,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateMany with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -117,8 +154,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -135,17 +171,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -164,18 +207,18 @@ } ] } - } + ] }, { "description": "BulkWrite replaceOne with update hints unsupported (client-side error)", "operations": [ { + "object": "collection0", "name": "bulkWrite", "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 3 }, @@ -186,8 +229,7 @@ } }, { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 4 }, @@ -200,17 +242,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -229,7 +278,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-update-hint-clientError.yml b/test/spec/crud/unified/bulkWrite-update-hint-clientError.yml new file mode 100644 index 00000000000..df1eae485ee --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-hint-clientError.yml @@ -0,0 +1,148 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite updateMany with update hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome + - + description: 'BulkWrite replaceOne with update hints unsupported (client-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/bulkWrite-update-hint-serverError.json b/test/spec/crud/unified/bulkWrite-update-hint-serverError.json new file mode 100644 index 00000000000..b0f7e1b3817 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-hint-serverError.json @@ -0,0 +1,422 @@ +{ + "description": "bulkWrite-update-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with update hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite updateMany with update hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite replaceOne with update hints unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 3 + }, + "u": { + "x": 333 + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + }, + { + "q": { + "_id": 4 + }, + "u": { + "x": 444 + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/bulkWrite-update-hint-serverError.yml b/test/spec/crud/unified/bulkWrite-update-hint-serverError.yml new file mode 100644 index 00000000000..bda128b55df --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-hint-serverError.yml @@ -0,0 +1,249 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateOne_filter + u: *updateOne_update + hint: *hint_string + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: *updateOne_filter + u: *updateOne_update + hint: *hint_doc + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite updateMany with update hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateMany_filter + u: *updateMany_update + multi: true + hint: *hint_string + upsert: + $$unsetOrMatches: false + - + q: *updateMany_filter + u: *updateMany_update + multi: true + hint: *hint_doc + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite replaceOne with update hints unsupported (server-side error)' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 3 + u: + x: 333 + hint: *hint_string + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + - + q: + _id: 4 + u: + x: 444 + hint: *hint_doc + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 diff --git a/test/spec/crud/unified/bulkWrite-update-hint.json b/test/spec/crud/unified/bulkWrite-update-hint.json new file mode 100644 index 00000000000..4206359891f --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-hint.json @@ -0,0 +1,445 @@ +{ + "description": "bulkWrite-update-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_bulkwrite_update_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ], + "tests": [ + { + "description": "BulkWrite updateOne with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": 1 + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 13 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite updateMany with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$lt": 3 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 4, + "modifiedCount": 4, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": { + "$lt": 3 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 13 + }, + { + "_id": 2, + "x": 24 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "BulkWrite replaceOne with update hints", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "replaceOne": { + "filter": { + "_id": 3 + }, + "replacement": { + "x": 333 + }, + "hint": "_id_" + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "x": 444 + }, + "hint": { + "_id": 1 + } + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 0, + "insertedCount": 0, + "insertedIds": { + "$$unsetOrMatches": {} + }, + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0, + "upsertedIds": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_bulkwrite_update_hint", + "updates": [ + { + "q": { + "_id": 3 + }, + "u": { + "x": 333 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": "_id_" + }, + { + "q": { + "_id": 4 + }, + "u": { + "x": 444 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + }, + "hint": { + "_id": 1 + } + } + ], + "ordered": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 333 + }, + { + "_id": 4, + "x": 444 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/bulkWrite-update-hint.yml b/test/spec/crud/unified/bulkWrite-update-hint.yml new file mode 100644 index 00000000000..9f5a0e080ec --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-hint.yml @@ -0,0 +1,256 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: bulkWrite-update-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_bulkwrite_update_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'BulkWrite updateOne with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateOne_filter + u: *updateOne_update + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: *updateOne_filter + u: *updateOne_update + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 13 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite updateMany with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 4 + modifiedCount: 4 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *updateMany_filter + u: *updateMany_update + multi: true + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: *updateMany_filter + u: *updateMany_update + multi: true + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 13 + - + _id: 2 + x: 24 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'BulkWrite replaceOne with update hints' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectResult: + deletedCount: 0 + insertedCount: 0 + insertedIds: { $$unsetOrMatches: {} } + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + upsertedIds: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 3 + u: + x: 333 + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_string + - + q: + _id: 4 + u: + x: 444 + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + hint: *hint_doc + ordered: true + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 333 + - + _id: 4 + x: 444 diff --git a/test/spec/crud/v2/bulkWrite-update-validation.json b/test/spec/crud/unified/bulkWrite-update-validation.json similarity index 54% rename from test/spec/crud/v2/bulkWrite-update-validation.json rename to test/spec/crud/unified/bulkWrite-update-validation.json index 481e13c45cc..f9bfda0edd0 100644 --- a/test/spec/crud/v2/bulkWrite-update-validation.json +++ b/test/spec/crud/unified/bulkWrite-update-validation.json @@ -1,16 +1,48 @@ { - "data": [ + "description": "bulkWrite-update-validation", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } }, { - "_id": 3, - "x": 33 + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] } ], "tests": [ @@ -19,11 +51,11 @@ "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 1 }, @@ -36,13 +68,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -57,18 +98,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateOne requires atomic modifiers", "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -79,13 +120,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -100,18 +150,18 @@ } ] } - } + ] }, { "description": "BulkWrite updateMany requires atomic modifiers", "operations": [ { "name": "bulkWrite", + "object": "collection0", "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$gt": 1 @@ -124,13 +174,22 @@ } ] }, - "error": true + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ { "_id": 1, "x": 11 @@ -145,7 +204,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-update-validation.yml b/test/spec/crud/unified/bulkWrite-update-validation.yml new file mode 100644 index 00000000000..57defd56a46 --- /dev/null +++ b/test/spec/crud/unified/bulkWrite-update-validation.yml @@ -0,0 +1,73 @@ +description: "bulkWrite-update-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + +tests: + - description: "BulkWrite replaceOne prohibits atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - replaceOne: + filter: { _id: 1 } + replacement: { $set: { x: 22 } } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData + + - description: "BulkWrite updateOne requires atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - updateOne: + filter: { _id: 1 } + update: { x: 22 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData + + - description: "BulkWrite updateMany requires atomic modifiers" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - updateMany: + filter: { _id: { $gt: 1 } } + update: { x: 44 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/crud-let.json b/test/spec/crud/unified/crud-let.json deleted file mode 100644 index d0612dfd580..00000000000 --- a/test/spec/crud/unified/crud-let.json +++ /dev/null @@ -1,513 +0,0 @@ -{ - "description": "crud-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - } - ] - } - ], - "tests": [ - { - "description": "Find with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectResult": [ - { - "x": "foo" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Find with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$match": { - "_id": 1 - } - }, - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "Unrecognized field 'let'", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "$match": { - "_id": 1 - } - }, - "let": { - "x": "foo" - } - } - } - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$match": { - "_id": 1 - } - }, - "update": { - "$set": {} - }, - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "'let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$match": { - "_id": 1 - } - }, - "update": { - "$set": {} - }, - "let": { - "x": "foo" - } - } - } - } - ] - } - ] - }, - { - "description": "Update with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "$set": {} - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Update with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "$set": {} - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "$set": {} - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Delete with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 10 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 10 - } - } - } - } - ] - } - ] - }, - { - "description": "Delete with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 10 - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 10 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/test/spec/crud/unified/crud-let.yml b/test/spec/crud/unified/crud-let.yml deleted file mode 100644 index e7bd22b036f..00000000000 --- a/test/spec/crud/unified/crud-let.yml +++ /dev/null @@ -1,221 +0,0 @@ -# NOTE: Not yet committed upstream as a spec test! - -description: "crud-let" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 client0 - observeEvents: [ commandStartedEvent ] - - database: - id: &database0 database0 - client: *client0 - databaseName: &database0Name crud-tests - - collection: - id: &collection0 collection0 - database: *database0 - collectionName: &collection0Name coll0 - -initialData: &initialData - - collectionName: *collection0Name - databaseName: *database0Name - documents: - - { _id: 1, x: "foo" } - -tests: - - description: "Find with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: find - object: *collection0 - arguments: - filter: &query0 - $expr: { $eq: ["$_id", "$$id"] } - let: &let0 - id: 1 - expectResult: - - { x: "foo" } - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: *query0 - let: *let0 - - - description: "Find with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: find - object: *collection0 - arguments: - filter: &query1 - $match: { _id: 1 } - let: &let1 - x: foo - expectError: - errorContains: "Unrecognized field 'let'" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: *query1 - let: *let1 - - - description: "FindOneAndUpdate with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: findOneAndUpdate - object: *collection0 - arguments: - filter: &query2 - $expr: { $eq: ["$_id", "$$id"] } - update: &update2 - $set: {} - let: &let2 - id: 1 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *query2 - update: *update2 - let: *let2 - - - description: "FindOneAndUpdate with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: findOneAndUpdate - object: *collection0 - arguments: - filter: &query3 - $match: { _id: 1 } - update: &update3 - $set: {} - let: &let3 - x: foo - expectError: - errorContains: "'let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *query3 - update: *update3 - let: *let3 - - - description: "Update with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: updateOne - object: *collection0 - arguments: - filter: &query4 - $expr: { $eq: ["$_id", "$$id"] } - update: &update4 - $set: {} - let: &let4 - id: 1 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - q: *query4 - u: *update4 - let: *let4 - - - description: "Update with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: updateOne - object: *collection0 - arguments: - filter: &query5 - $expr: { $eq: ["$_id", "$$id"] } - update: &update5 - $set: {} - let: &let5 - id: 1 - expectError: - errorContains: "'update.let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - q: *query5 - u: *update5 - let: *let5 - - - description: "Delete with let option" - runOnRequirements: - - minServerVersion: "5.0" - operations: - - name: deleteOne - object: *collection0 - arguments: - filter: &query6 - $expr: { $eq: ["$_id", "$$id"] } - let: &let6 - id: 10 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *query6 - limit: 1 - let: *let6 - - - description: "Delete with let option unsupported (server-side error)" - runOnRequirements: - - minServerVersion: "4.2.0" - maxServerVersion: "4.4.99" - operations: - - name: deleteOne - object: *collection0 - arguments: - filter: &query7 - $expr: { $eq: ["$_id", "$$id"] } - let: &let7 - id: 10 - expectError: - errorContains: "'delete.let' is an unknown field" - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *query7 - limit: 1 - let: *let7 diff --git a/test/spec/crud/v2/db-aggregate.json b/test/spec/crud/unified/db-aggregate.json similarity index 68% rename from test/spec/crud/v2/db-aggregate.json rename to test/spec/crud/unified/db-aggregate.json index d88b9e18197..5015405bfca 100644 --- a/test/spec/crud/v2/db-aggregate.json +++ b/test/spec/crud/unified/db-aggregate.json @@ -1,17 +1,43 @@ { - "runOn": [ + "description": "db-aggregate", + "schemaVersion": "1.4", + "runOnRequirements": [ { - "minServerVersion": "3.6.0" + "minServerVersion": "3.6.0", + "serverless": "forbid" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "admin" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "crud-v2" + } } ], - "database_name": "admin", "tests": [ { "description": "Aggregate with $listLocalSessions", "operations": [ { + "object": "database0", "name": "aggregate", - "object": "database", "arguments": { "pipeline": [ { @@ -33,7 +59,7 @@ } ] }, - "result": [ + "expectResult": [ { "dummy": "dummy field" } @@ -45,8 +71,8 @@ "description": "Aggregate with $listLocalSessions and allowDiskUse", "operations": [ { + "object": "database0", "name": "aggregate", - "object": "database", "arguments": { "pipeline": [ { @@ -69,7 +95,7 @@ ], "allowDiskUse": true }, - "result": [ + "expectResult": [ { "dummy": "dummy field" } diff --git a/test/spec/crud/unified/db-aggregate.yml b/test/spec/crud/unified/db-aggregate.yml new file mode 100644 index 00000000000..032f94c7313 --- /dev/null +++ b/test/spec/crud/unified/db-aggregate.yml @@ -0,0 +1,73 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: db-aggregate +schemaVersion: '1.4' +runOnRequirements: + - + minServerVersion: 3.6.0 + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + serverless: forbid +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name admin + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name crud-v2 +tests: + - + description: 'Aggregate with $listLocalSessions' + operations: + - + object: *database0 + name: aggregate + arguments: + pipeline: + - + $listLocalSessions: { } + - + $limit: 1 + - + $addFields: + dummy: 'dummy field' + - + $project: + _id: 0 + dummy: 1 + expectResult: + - + dummy: 'dummy field' + - + description: 'Aggregate with $listLocalSessions and allowDiskUse' + operations: + - + object: *database0 + name: aggregate + arguments: + pipeline: + - + $listLocalSessions: { } + - + $limit: 1 + - + $addFields: + dummy: 'dummy field' + - + $project: + _id: 0 + dummy: 1 + allowDiskUse: true + expectResult: + - + dummy: 'dummy field' diff --git a/test/spec/crud/unified/deleteMany-hint-clientError.json b/test/spec/crud/unified/deleteMany-hint-clientError.json new file mode 100644 index 00000000000..66320122b5b --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint-clientError.json @@ -0,0 +1,149 @@ +{ + "description": "deleteMany-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteMany-hint-clientError.yml b/test/spec/crud/unified/deleteMany-hint-clientError.yml new file mode 100644 index 00000000000..21ff1debbe4 --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint-clientError.yml @@ -0,0 +1,87 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'DeleteMany with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/deleteMany-hint-serverError.json b/test/spec/crud/unified/deleteMany-hint-serverError.json new file mode 100644 index 00000000000..88d4a655769 --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint-serverError.json @@ -0,0 +1,190 @@ +{ + "description": "deleteMany-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_", + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteMany-hint-serverError.yml b/test/spec/crud/unified/deleteMany-hint-serverError.yml new file mode 100644 index 00000000000..2e20988d0b5 --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint-serverError.yml @@ -0,0 +1,107 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 0 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'DeleteMany with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 0 + outcome: *outcome diff --git a/test/spec/crud/unified/deleteMany-hint.json b/test/spec/crud/unified/deleteMany-hint.json new file mode 100644 index 00000000000..59d903d201f --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint.json @@ -0,0 +1,173 @@ +{ + "description": "deleteMany-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "DeleteMany with hint string", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "deletedCount": 2 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_", + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + }, + { + "description": "DeleteMany with hint document", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 2 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteMany_hint", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + }, + "limit": 0 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteMany-hint.yml b/test/spec/crud/unified/deleteMany-hint.yml new file mode 100644 index 00000000000..512b95e76b6 --- /dev/null +++ b/test/spec/crud/unified/deleteMany-hint.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteMany-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'DeleteMany with hint string' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectResult: &result + deletedCount: 2 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 0 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + description: 'DeleteMany with hint document' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 0 + outcome: *outcome diff --git a/test/spec/crud/unified/deleteOne-hint-clientError.json b/test/spec/crud/unified/deleteOne-hint-clientError.json new file mode 100644 index 00000000000..cf629f59e03 --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "deleteOne-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "DeleteOne with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteOne-hint-clientError.yml b/test/spec/crud/unified/deleteOne-hint-clientError.yml new file mode 100644 index 00000000000..be218fc9b5a --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint-clientError.yml @@ -0,0 +1,80 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'DeleteOne with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/deleteOne-hint-serverError.json b/test/spec/crud/unified/deleteOne-hint-serverError.json new file mode 100644 index 00000000000..15541ed857b --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint-serverError.json @@ -0,0 +1,170 @@ +{ + "description": "deleteOne-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "DeleteOne with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteOne-hint-serverError.yml b/test/spec/crud/unified/deleteOne-hint-serverError.yml new file mode 100644 index 00000000000..6c8c0ea8171 --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint-serverError.yml @@ -0,0 +1,100 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 1 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'DeleteOne with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/deleteOne-hint.json b/test/spec/crud/unified/deleteOne-hint.json new file mode 100644 index 00000000000..bcc4bc2347a --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint.json @@ -0,0 +1,161 @@ +{ + "description": "deleteOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint" + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "DeleteOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectResult": { + "deletedCount": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": "_id_", + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "deleteOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "deletedCount": 1 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "DeleteOne_hint", + "deletes": [ + { + "q": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "limit": 1 + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/deleteOne-hint.yml b/test/spec/crud/unified/deleteOne-hint.yml new file mode 100644 index 00000000000..f72356c99ce --- /dev/null +++ b/test/spec/crud/unified/deleteOne-hint.yml @@ -0,0 +1,95 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: deleteOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'DeleteOne with hint string' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectResult: &result + deletedCount: 1 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: _id_ + limit: 1 + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + description: 'deleteOne with hint document' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + delete: *collection_name + deletes: + - + q: *filter + hint: + _id: 1 + limit: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/find-allowdiskuse-clientError.json b/test/spec/crud/unified/find-allowdiskuse-clientError.json new file mode 100644 index 00000000000..5bd954e79d7 --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-clientError.json @@ -0,0 +1,79 @@ +{ + "description": "find-allowdiskuse-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse_clienterror" + } + } + ], + "tests": [ + { + "description": "Find fails when allowDiskUse true is specified against pre 3.2 server", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Find fails when allowDiskUse false is specified against pre 3.2 server", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/find-allowdiskuse-clientError.yml b/test/spec/crud/unified/find-allowdiskuse-clientError.yml new file mode 100644 index 00000000000..2bc26908fed --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-clientError.yml @@ -0,0 +1,55 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse_clienterror +tests: + - + description: 'Find fails when allowDiskUse true is specified against pre 3.2 server' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + - + description: 'Find fails when allowDiskUse false is specified against pre 3.2 server' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: false + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.json b/test/spec/crud/unified/find-allowdiskuse-serverError.json new file mode 100644 index 00000000000..dc58f8f0e3a --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-serverError.json @@ -0,0 +1,100 @@ +{ + "description": "find-allowdiskuse-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.2", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse_servererror" + } + } + ], + "tests": [ + { + "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": true + } + } + } + ] + } + ] + }, + { + "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": false + } + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.yml b/test/spec/crud/unified/find-allowdiskuse-serverError.yml new file mode 100644 index 00000000000..de73d8b37da --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-serverError.yml @@ -0,0 +1,68 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: '3.2' + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse_servererror +tests: + - + description: 'Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: &filter { } + allowDiskUse: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: true + - + description: 'Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: *filter + allowDiskUse: false + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: false diff --git a/test/spec/crud/unified/find-allowdiskuse.json b/test/spec/crud/unified/find-allowdiskuse.json new file mode 100644 index 00000000000..789bb7fbf13 --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse.json @@ -0,0 +1,120 @@ +{ + "description": "find-allowdiskuse", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse" + } + } + ], + "tests": [ + { + "description": "Find does not send allowDiskuse when value is not specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {} + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": { + "$$exists": false + } + } + } + } + ] + } + ] + }, + { + "description": "Find sends allowDiskuse false when false is specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": false + } + } + } + ] + } + ] + }, + { + "description": "Find sends allowDiskUse true when true is specified", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse", + "allowDiskUse": true + } + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/find-allowdiskuse.yml b/test/spec/crud/unified/find-allowdiskuse.yml new file mode 100644 index 00000000000..b2de4037dca --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse.yml @@ -0,0 +1,79 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: find-allowdiskuse +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse +tests: + - + description: 'Find does not send allowDiskuse when value is not specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: + $$exists: false + - + description: 'Find sends allowDiskuse false when false is specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: false + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: false + - + description: 'Find sends allowDiskUse true when true is specified' + operations: + - + object: *collection0 + name: find + arguments: + filter: { } + allowDiskUse: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + allowDiskUse: true diff --git a/test/spec/crud/unified/find.json b/test/spec/crud/unified/find.json new file mode 100644 index 00000000000..275d5d351a1 --- /dev/null +++ b/test/spec/crud/unified/find.json @@ -0,0 +1,156 @@ +{ + "description": "find", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": true, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "find-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "find-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "tests": [ + { + "description": "find with multiple batches works", + "operations": [ + { + "name": "find", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2 + }, + "commandName": "find", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2 + }, + "commandName": "getMore", + "databaseName": "find-tests" + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/find.yml b/test/spec/crud/unified/find.yml new file mode 100644 index 00000000000..5615f072348 --- /dev/null +++ b/test/spec/crud/unified/find.yml @@ -0,0 +1,68 @@ +description: "find" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + useMultipleMongoses: true # ensure cursors pin to a single server + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name find-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + +tests: + - description: "find with multiple batches works" + operations: + - name: find + arguments: + filter: { _id: { $gt: 1 } } + batchSize: 2 + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + batchSize: 2 + commandName: find + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + commandName: getMore + databaseName: *database0Name + diff --git a/test/spec/crud/unified/findOneAndDelete-hint-clientError.json b/test/spec/crud/unified/findOneAndDelete-hint-clientError.json new file mode 100644 index 00000000000..c6ff467866d --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "findOneAndDelete-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndDelete-hint-clientError.yml b/test/spec/crud/unified/findOneAndDelete-hint-clientError.yml new file mode 100644 index 00000000000..220496872ae --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint-clientError.yml @@ -0,0 +1,91 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/test/spec/crud/unified/findOneAndDelete-hint-serverError.json b/test/spec/crud/unified/findOneAndDelete-hint-serverError.json new file mode 100644 index 00000000000..b874102728b --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint-serverError.json @@ -0,0 +1,162 @@ +{ + "description": "findOneAndDelete-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.3" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": "_id_", + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndDelete-hint-serverError.yml b/test/spec/crud/unified/findOneAndDelete-hint-serverError.yml new file mode 100644 index 00000000000..5fd21eedc0d --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint-serverError.yml @@ -0,0 +1,107 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.3 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: _id_ + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: + _id: 1 + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/test/spec/crud/unified/findOneAndDelete-hint.json b/test/spec/crud/unified/findOneAndDelete-hint.json new file mode 100644 index 00000000000..8b53f2bd3ff --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint.json @@ -0,0 +1,155 @@ +{ + "description": "findOneAndDelete-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.4" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndDelete with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": "_id_", + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndDelete with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndDelete_hint", + "query": { + "_id": 1 + }, + "hint": { + "_id": 1 + }, + "remove": true + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndDelete-hint.yml b/test/spec/crud/unified/findOneAndDelete-hint.yml new file mode 100644 index 00000000000..3dc4f3ff410 --- /dev/null +++ b/test/spec/crud/unified/findOneAndDelete-hint.yml @@ -0,0 +1,102 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndDelete-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.4 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndDelete with hint string' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: _id_ + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 + - + description: 'FindOneAndDelete with hint document' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + hint: + _id: 1 + remove: true + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 2 + x: 22 diff --git a/test/spec/crud/unified/findOneAndReplace-hint-clientError.json b/test/spec/crud/unified/findOneAndReplace-hint-clientError.json new file mode 100644 index 00000000000..6b07eb1f4d9 --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint-clientError.json @@ -0,0 +1,139 @@ +{ + "description": "findOneAndReplace-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndReplace-hint-clientError.yml b/test/spec/crud/unified/findOneAndReplace-hint-clientError.yml new file mode 100644 index 00000000000..f59952ffc08 --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/findOneAndReplace-hint-serverError.json b/test/spec/crud/unified/findOneAndReplace-hint-serverError.json new file mode 100644 index 00000000000..7fbf5a0ea3b --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint-serverError.json @@ -0,0 +1,172 @@ +{ + "description": "findOneAndReplace-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndReplace-hint-serverError.yml b/test/spec/crud/unified/findOneAndReplace-hint-serverError.yml new file mode 100644 index 00000000000..664cd0bbc53 --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint-serverError.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: + _id: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/findOneAndReplace-hint.json b/test/spec/crud/unified/findOneAndReplace-hint.json new file mode 100644 index 00000000000..d07c5921a7a --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint.json @@ -0,0 +1,173 @@ +{ + "description": "findOneAndReplace-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndReplace_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndReplace with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 33 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndReplace with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndReplace_hint", + "query": { + "_id": 1 + }, + "update": { + "x": 33 + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 33 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndReplace-hint.yml b/test/spec/crud/unified/findOneAndReplace-hint.yml new file mode 100644 index 00000000000..9c581270a7e --- /dev/null +++ b/test/spec/crud/unified/findOneAndReplace-hint.yml @@ -0,0 +1,98 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndReplace-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndReplace_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndReplace with hint string' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 33 + - + _id: 2 + x: 22 + - + description: 'FindOneAndReplace with hint document' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *replacement + hint: + _id: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-clientError.json b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.json new file mode 100644 index 00000000000..d0b51313c95 --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "findOneAndUpdate-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "4.0.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml new file mode 100644 index 00000000000..5ad4f07ccf1 --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint-clientError.yml @@ -0,0 +1,84 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 4.0.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-serverError.json b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.json new file mode 100644 index 00000000000..99fd9938f8c --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.json @@ -0,0 +1,180 @@ +{ + "description": "findOneAndUpdate-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml new file mode 100644 index 00000000000..f6b4f8d6233 --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint-serverError.yml @@ -0,0 +1,100 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: + _id: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/findOneAndUpdate-hint.json b/test/spec/crud/unified/findOneAndUpdate-hint.json new file mode 100644 index 00000000000..5be6d2b3e8e --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint.json @@ -0,0 +1,181 @@ +{ + "description": "findOneAndUpdate-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.3.1" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndUpdate_hint" + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "FindOneAndUpdate with hint string", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 12 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate with hint document", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "_id": 1, + "x": 11 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "findOneAndUpdate_hint", + "query": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "findOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 12 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/findOneAndUpdate-hint.yml b/test/spec/crud/unified/findOneAndUpdate-hint.yml new file mode 100644 index 00000000000..5e835faa9e5 --- /dev/null +++ b/test/spec/crud/unified/findOneAndUpdate-hint.yml @@ -0,0 +1,99 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: findOneAndUpdate-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.3.1 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndUpdate_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'FindOneAndUpdate with hint string' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + _id: 1 + x: 11 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: _id_ + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 12 + - + _id: 2 + x: 22 + - + description: 'FindOneAndUpdate with hint document' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + query: *filter + update: *update + hint: + _id: 1 + outcome: *outcome diff --git a/test/spec/crud/unified/insertMany-dots_and_dollars.json b/test/spec/crud/unified/insertMany-dots_and_dollars.json index 3b66ac06216..eed8997df94 100644 --- a/test/spec/crud/unified/insertMany-dots_and_dollars.json +++ b/test/spec/crud/unified/insertMany-dots_and_dollars.json @@ -53,10 +53,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -162,10 +163,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -221,10 +223,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } @@ -284,10 +287,11 @@ ] }, "expectResult": { - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 + "$$unsetOrMatches": { + "insertedIds": { + "$$unsetOrMatches": { + "0": 1 + } } } } diff --git a/test/spec/crud/unified/insertMany-dots_and_dollars.yml b/test/spec/crud/unified/insertMany-dots_and_dollars.yml index 63bbe16197d..913a55e4c05 100644 --- a/test/spec/crud/unified/insertMany-dots_and_dollars.yml +++ b/test/spec/crud/unified/insertMany-dots_and_dollars.yml @@ -31,8 +31,8 @@ tests: documents: - &dollarPrefixedKey { _id: 1, $a: 1 } expectResult: &insertResult - insertedCount: 1 - insertedIds: { $$unsetOrMatches: { 0: 1 } } + # InsertManyResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedIds: { $$unsetOrMatches: { 0: 1 } } } expectEvents: &expectEventsDollarPrefixedKey - client: *client0 events: diff --git a/test/spec/crud/unified/insertOne-dots_and_dollars.json b/test/spec/crud/unified/insertOne-dots_and_dollars.json index 4b9fbfb80b4..fdc17af2e8f 100644 --- a/test/spec/crud/unified/insertOne-dots_and_dollars.json +++ b/test/spec/crud/unified/insertOne-dots_and_dollars.json @@ -63,8 +63,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -165,8 +167,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -219,8 +223,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -277,8 +283,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -386,9 +394,11 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": { - "a.b": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": { + "a.b": 1 + } } } } @@ -496,8 +506,10 @@ } }, "expectResult": { - "insertedId": { - "$$unsetOrMatches": 1 + "$$unsetOrMatches": { + "insertedId": { + "$$unsetOrMatches": 1 + } } } } @@ -558,8 +570,10 @@ } }, "expectResult": { - "acknowledged": { - "$$unsetOrMatches": false + "$$unsetOrMatches": { + "acknowledged": { + "$$unsetOrMatches": false + } } } } diff --git a/test/spec/crud/unified/insertOne-dots_and_dollars.yml b/test/spec/crud/unified/insertOne-dots_and_dollars.yml index f23fec2d51a..f255b52413b 100644 --- a/test/spec/crud/unified/insertOne-dots_and_dollars.yml +++ b/test/spec/crud/unified/insertOne-dots_and_dollars.yml @@ -36,7 +36,8 @@ tests: arguments: document: &dollarPrefixedKey { _id: 1, $a: 1 } expectResult: &insertResult - insertedId: { $$unsetOrMatches: 1 } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: 1 } } expectEvents: &expectEventsDollarPrefixedKey - client: *client0 events: @@ -155,7 +156,8 @@ tests: arguments: document: &dottedKeyInId { _id: { a.b: 1 } } expectResult: - insertedId: { $$unsetOrMatches: { a.b: 1 } } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedId: { $$unsetOrMatches: { a.b: 1 } } } expectEvents: &expectEventsDottedKeyInId - client: *client0 events: @@ -222,7 +224,8 @@ tests: arguments: document: *dollarPrefixedKeyInId expectResult: - acknowledged: { $$unsetOrMatches: false } + # InsertOneResult is optional because all of its fields are optional + $$unsetOrMatches: { acknowledged: { $$unsetOrMatches: false } } expectEvents: - client: *client0 events: diff --git a/test/spec/crud/unified/replaceOne-hint.json b/test/spec/crud/unified/replaceOne-hint.json new file mode 100644 index 00000000000..6926e9d8dfe --- /dev/null +++ b/test/spec/crud/unified/replaceOne-hint.json @@ -0,0 +1,203 @@ +{ + "description": "replaceOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_replaceone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "ReplaceOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_replaceone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "x": 111 + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 111 + } + ] + } + ] + }, + { + "description": "ReplaceOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_replaceone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "x": 111 + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_replaceone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 111 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/replaceOne-hint.yml b/test/spec/crud/unified/replaceOne-hint.yml new file mode 100644 index 00000000000..d00bf6744ce --- /dev/null +++ b/test/spec/crud/unified/replaceOne-hint.yml @@ -0,0 +1,112 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: replaceOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_replaceone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'ReplaceOne with hint string' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: &filter + _id: + $gt: 1 + replacement: &replacement + x: 111 + hint: _id_ + expectResult: &result + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *replacement + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 111 + - + description: 'ReplaceOne with hint document' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *replacement + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/test/spec/crud/unified/replaceOne-validation.json b/test/spec/crud/unified/replaceOne-validation.json new file mode 100644 index 00000000000..6f5b173e023 --- /dev/null +++ b/test/spec/crud/unified/replaceOne-validation.json @@ -0,0 +1,82 @@ +{ + "description": "replaceOne-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "ReplaceOne prohibits atomic modifiers", + "operations": [ + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/replaceOne-validation.yml b/test/spec/crud/unified/replaceOne-validation.yml new file mode 100644 index 00000000000..db5a2a6666c --- /dev/null +++ b/test/spec/crud/unified/replaceOne-validation.yml @@ -0,0 +1,37 @@ +description: "replaceOne-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + - description: "ReplaceOne prohibits atomic modifiers" + operations: + - name: replaceOne + object: *collection0 + arguments: + filter: { _id: 1 } + replacement: { $set: { x: 22 } } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json similarity index 53% rename from test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json rename to test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json index 46839db7056..dbaa2e84f47 100644 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.json +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.json @@ -1,39 +1,70 @@ { - "data": [ + "description": "unacknowledged-bulkWrite-delete-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "BulkWrite_delete_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] } ], - "collection_name": "BulkWrite_delete_hint", "tests": [ { "description": "Unacknowledged bulkWrite deleteOne with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 1 }, @@ -41,8 +72,7 @@ } }, { - "name": "deleteOne", - "arguments": { + "deleteOne": { "filter": { "_id": 2 }, @@ -52,17 +82,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -81,23 +118,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite deleteMany with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$lt": 3 @@ -107,8 +139,7 @@ } }, { - "name": "deleteMany", - "arguments": { + "deleteMany": { "filter": { "_id": { "$gte": 4 @@ -120,17 +151,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_delete_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -149,7 +187,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml new file mode 100644 index 00000000000..3aaa182436e --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-delete-hint-clientError.yml @@ -0,0 +1,112 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-bulkWrite-delete-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name BulkWrite_delete_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'Unacknowledged bulkWrite deleteOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteOne: + filter: &deleteOne_filter1 + _id: 1 + hint: &hint_string _id_ + - + deleteOne: + filter: &deleteOne_filter2 + _id: 2 + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'Unacknowledged bulkWrite deleteMany with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + deleteMany: + filter: &deleteMany_filter1 + _id: + $lt: 3 + hint: *hint_string + - + deleteMany: + filter: &deleteMany_filter2 + _id: + $gte: 4 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json similarity index 62% rename from test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json rename to test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json index 4a41d76b350..858967b90c5 100644 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.json +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.json @@ -1,39 +1,70 @@ { - "data": [ + "description": "unacknowledged-bulkWrite-update-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 - }, + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "Bulkwrite_update_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ { - "_id": 4, - "x": 44 + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] } ], - "collection_name": "Bulkwrite_update_hint", "tests": [ { "description": "Unacknowledged bulkWrite updateOne with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -46,8 +77,7 @@ } }, { - "name": "updateOne", - "arguments": { + "updateOne": { "filter": { "_id": 1 }, @@ -62,17 +92,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -91,23 +128,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite updateMany with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -122,8 +154,7 @@ } }, { - "name": "updateMany", - "arguments": { + "updateMany": { "filter": { "_id": { "$lt": 3 @@ -140,17 +171,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -169,23 +207,18 @@ } ] } - } + ] }, { "description": "Unacknowledged bulkWrite replaceOne with hints fails with client-side error", "operations": [ { + "object": "collection0", "name": "bulkWrite", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, "arguments": { "requests": [ { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 3 }, @@ -196,8 +229,7 @@ } }, { - "name": "replaceOne", - "arguments": { + "replaceOne": { "filter": { "_id": 4 }, @@ -210,17 +242,24 @@ } } ], - "options": { - "ordered": true - } + "ordered": true }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Bulkwrite_update_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -239,7 +278,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml new file mode 100644 index 00000000000..95620f097a2 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-bulkWrite-update-hint-clientError.yml @@ -0,0 +1,147 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-bulkWrite-update-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name Bulkwrite_update_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 +tests: + - + description: 'Unacknowledged bulkWrite updateOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: &updateOne_filter + _id: 1 + update: &updateOne_update + $inc: + x: 1 + hint: &hint_string _id_ + - + updateOne: + filter: *updateOne_filter + update: *updateOne_update + hint: &hint_doc + _id: 1 + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + _id: 4 + x: 44 + - + description: 'Unacknowledged bulkWrite updateMany with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: &updateMany_filter + _id: + $lt: 3 + update: &updateMany_update + $inc: + x: 1 + hint: *hint_string + - + updateMany: + filter: *updateMany_filter + update: *updateMany_update + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome + - + description: 'Unacknowledged bulkWrite replaceOne with hints fails with client-side error' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + replaceOne: + filter: + _id: 3 + replacement: + x: 333 + hint: *hint_string + - + replaceOne: + filter: + _id: 4 + replacement: + x: 444 + hint: *hint_doc + ordered: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json new file mode 100644 index 00000000000..c5d9f6af36f --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.json @@ -0,0 +1,149 @@ +{ + "description": "unacknowledged-deleteMany-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteMany_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged deleteMany with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Unacknowledged deleteMany with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteMany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml new file mode 100644 index 00000000000..7acbbc7ca85 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-deleteMany-hint-clientError.yml @@ -0,0 +1,86 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-deleteMany-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteMany_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Unacknowledged deleteMany with hint string fails with client-side error' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: &filter + _id: + $gt: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Unacknowledged deleteMany with hint document fails with client-side error' + operations: + - + object: *collection0 + name: deleteMany + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json new file mode 100644 index 00000000000..177ad889bbd --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "unacknowledged-deleteOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "DeleteOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged deleteOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged deleteOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "DeleteOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml new file mode 100644 index 00000000000..996dad6cacb --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-deleteOne-hint-clientError.yml @@ -0,0 +1,79 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-deleteOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name DeleteOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged deleteOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged deleteOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: deleteOne + arguments: + filter: *filter + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json new file mode 100644 index 00000000000..6ee59cdf644 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.json @@ -0,0 +1,133 @@ +{ + "description": "unacknowledged-findOneAndDelete-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "findOneAndDelete_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": 1 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "findOneAndDelete_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml new file mode 100644 index 00000000000..7a619d30a07 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndDelete-hint-clientError.yml @@ -0,0 +1,90 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndDelete-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name findOneAndDelete_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndDelete with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndDelete with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter + _id: 1 + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 diff --git a/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json new file mode 100644 index 00000000000..15ca7732288 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.json @@ -0,0 +1,139 @@ +{ + "description": "unacknowledged-findOneAndReplace-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "FindOneAndReplace_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 33 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndReplace_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml new file mode 100644 index 00000000000..cbd12dac98d --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndReplace-hint-clientError.yml @@ -0,0 +1,82 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndReplace-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name FindOneAndReplace_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndReplace with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: &filter + _id: 1 + replacement: &replacement + x: 33 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndReplace with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndReplace + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json new file mode 100644 index 00000000000..e18767f8b23 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "unacknowledged-findOneAndUpdate-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "FindOneAndUpdate_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "FindOneAndUpdate_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml new file mode 100644 index 00000000000..b9cd0229cb7 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-findOneAndUpdate-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-findOneAndUpdate-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name FindOneAndUpdate_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged findOneAndUpdate with hint string fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: &filter + _id: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged findOneAndUpdate with hint document fails with client-side error' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json new file mode 100644 index 00000000000..52ec59d0c0b --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.json @@ -0,0 +1,143 @@ +{ + "description": "unacknowledged-replaceOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "ReplaceOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged ReplaceOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged ReplaceOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "replaceOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "ReplaceOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml new file mode 100644 index 00000000000..710cd424b1f --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-replaceOne-hint-clientError.yml @@ -0,0 +1,83 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-replaceOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name ReplaceOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged ReplaceOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: &filter + _id: + $gt: 1 + replacement: &replacement + x: 111 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged ReplaceOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: replaceOne + arguments: + filter: *filter + replacement: *replacement + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json new file mode 100644 index 00000000000..6199dfa2be9 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.json @@ -0,0 +1,159 @@ +{ + "description": "unacknowledged-updateMany-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "Updatemany_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged updateMany with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Unacknowledged updateMany with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "Updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml new file mode 100644 index 00000000000..1594c7cd44f --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-updateMany-hint-clientError.yml @@ -0,0 +1,90 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-updateMany-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name Updatemany_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'Unacknowledged updateMany with hint string fails with client-side error' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'Unacknowledged updateMany with hint document fails with client-side error' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json new file mode 100644 index 00000000000..3828a9e8df5 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.json @@ -0,0 +1,147 @@ +{ + "description": "unacknowledged-updateOne-hint-clientError", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "UpdateOne_hint", + "collectionOptions": { + "writeConcern": { + "w": 0 + } + } + } + } + ], + "initialData": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "Unacknowledged updateOne with hint string fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "Unacknowledged updateOne with hint document fails with client-side error", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "UpdateOne_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml new file mode 100644 index 00000000000..49126ea0060 --- /dev/null +++ b/test/spec/crud/unified/unacknowledged-updateOne-hint-clientError.yml @@ -0,0 +1,84 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: unacknowledged-updateOne-hint-clientError +schemaVersion: '1.0' +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name UpdateOne_hint + collectionOptions: + writeConcern: { w: 0 } +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'Unacknowledged updateOne with hint string fails with client-side error' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'Unacknowledged updateOne with hint document fails with client-side error' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/v2/updateMany-hint-clientError.json b/test/spec/crud/unified/updateMany-hint-clientError.json similarity index 50% rename from test/spec/crud/v2/updateMany-hint-clientError.json rename to test/spec/crud/unified/updateMany-hint-clientError.json index 44ebddc53da..5da878e293c 100644 --- a/test/spec/crud/v2/updateMany-hint-clientError.json +++ b/test/spec/crud/unified/updateMany-hint-clientError.json @@ -1,30 +1,61 @@ { - "runOn": [ + "description": "updateMany-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ { "maxServerVersion": "3.3.99" } ], - "data": [ + "createEntities": [ { - "_id": 1, - "x": 11 + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } }, { - "_id": 2, - "x": 22 + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } }, { - "_id": 3, - "x": 33 + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] } ], - "collection_name": "test_updatemany_hint", "tests": [ { "description": "UpdateMany with hint string unsupported (client-side error)", "operations": [ { - "object": "collection", + "object": "collection0", "name": "updateMany", "arguments": { "filter": { @@ -39,13 +70,22 @@ }, "hint": "_id_" }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -60,13 +100,13 @@ } ] } - } + ] }, { "description": "UpdateMany with hint document unsupported (client-side error)", "operations": [ { - "object": "collection", + "object": "collection0", "name": "updateMany", "arguments": { "filter": { @@ -83,13 +123,22 @@ "_id": 1 } }, - "error": true + "expectError": { + "isError": true + } } ], - "expectations": [], - "outcome": { - "collection": { - "data": [ + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ { "_id": 1, "x": 11 @@ -104,7 +153,7 @@ } ] } - } + ] } ] } diff --git a/test/spec/crud/unified/updateMany-hint-clientError.yml b/test/spec/crud/unified/updateMany-hint-clientError.yml new file mode 100644 index 00000000000..9734078ce37 --- /dev/null +++ b/test/spec/crud/unified/updateMany-hint-clientError.yml @@ -0,0 +1,91 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'UpdateMany with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/updateMany-hint-serverError.json b/test/spec/crud/unified/updateMany-hint-serverError.json new file mode 100644 index 00000000000..c81f36b13cd --- /dev/null +++ b/test/spec/crud/unified/updateMany-hint-serverError.json @@ -0,0 +1,216 @@ +{ + "description": "updateMany-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "UpdateMany with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateMany-hint-serverError.yml b/test/spec/crud/unified/updateMany-hint-serverError.yml new file mode 100644 index 00000000000..9e392c266db --- /dev/null +++ b/test/spec/crud/unified/updateMany-hint-serverError.yml @@ -0,0 +1,117 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: _id_ + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 + - + description: 'UpdateMany with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: + _id: 1 + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/test/spec/crud/unified/updateMany-hint.json b/test/spec/crud/unified/updateMany-hint.json new file mode 100644 index 00000000000..929be529946 --- /dev/null +++ b/test/spec/crud/unified/updateMany-hint.json @@ -0,0 +1,219 @@ +{ + "description": "updateMany-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updatemany_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany with hint string", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": "_id_", + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + }, + { + "_id": 3, + "x": 34 + } + ] + } + ] + }, + { + "description": "UpdateMany with hint document", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updatemany_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "multi": true, + "hint": { + "_id": 1 + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updatemany_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + }, + { + "_id": 3, + "x": 34 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateMany-hint.yml b/test/spec/crud/unified/updateMany-hint.yml new file mode 100644 index 00000000000..7ddb3a7b11c --- /dev/null +++ b/test/spec/crud/unified/updateMany-hint.yml @@ -0,0 +1,117 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateMany-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updatemany_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + _id: 3 + x: 33 +tests: + - + description: 'UpdateMany with hint string' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: _id_ + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 23 + - + _id: 3 + x: 34 + - + description: 'UpdateMany with hint document' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + multi: true + hint: + _id: 1 + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/test/spec/crud/unified/updateMany-validation.json b/test/spec/crud/unified/updateMany-validation.json new file mode 100644 index 00000000000..e3e46a1384c --- /dev/null +++ b/test/spec/crud/unified/updateMany-validation.json @@ -0,0 +1,98 @@ +{ + "description": "updateMany-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "UpdateMany requires atomic modifiers", + "operations": [ + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "x": 44 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateMany-validation.yml b/test/spec/crud/unified/updateMany-validation.yml new file mode 100644 index 00000000000..4e86eff1f37 --- /dev/null +++ b/test/spec/crud/unified/updateMany-validation.yml @@ -0,0 +1,39 @@ +description: "updateMany-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + +tests: + - description: "UpdateMany requires atomic modifiers" + operations: + - name: updateMany + object: *collection0 + arguments: + filter: { _id: { $gt: 1 } } + update: { x: 44 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/updateOne-hint-clientError.json b/test/spec/crud/unified/updateOne-hint-clientError.json new file mode 100644 index 00000000000..d4f1a53430a --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint-clientError.json @@ -0,0 +1,147 @@ +{ + "description": "updateOne-hint-clientError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "maxServerVersion": "3.3.99" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document unsupported (client-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateOne-hint-clientError.yml b/test/spec/crud/unified/updateOne-hint-clientError.yml new file mode 100644 index 00000000000..87b4444c3ae --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint-clientError.yml @@ -0,0 +1,85 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint-clientError +schemaVersion: '1.0' +runOnRequirements: + - + maxServerVersion: 3.3.99 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'UpdateOne with hint document unsupported (client-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: [] + outcome: *outcome diff --git a/test/spec/crud/unified/updateOne-hint-serverError.json b/test/spec/crud/unified/updateOne-hint-serverError.json new file mode 100644 index 00000000000..05fb0333190 --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint-serverError.json @@ -0,0 +1,208 @@ +{ + "description": "updateOne-hint-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.1.9" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document unsupported (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateOne-hint-serverError.yml b/test/spec/crud/unified/updateOne-hint-serverError.yml new file mode 100644 index 00000000000..f95c2b32178 --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint-serverError.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 3.4.0 + maxServerVersion: 4.1.9 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 + - + description: 'UpdateOne with hint document unsupported (server-side error)' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/test/spec/crud/unified/updateOne-hint.json b/test/spec/crud/unified/updateOne-hint.json new file mode 100644 index 00000000000..484e00757dc --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint.json @@ -0,0 +1,211 @@ +{ + "description": "updateOne-hint", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_updateone_hint" + } + } + ], + "initialData": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne with hint string", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_", + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + } + ] + } + ] + }, + { + "description": "UpdateOne with hint document", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test_updateone_hint", + "updates": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "u": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test_updateone_hint", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 23 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateOne-hint.yml b/test/spec/crud/unified/updateOne-hint.yml new file mode 100644 index 00000000000..55193582fb0 --- /dev/null +++ b/test/spec/crud/unified/updateOne-hint.yml @@ -0,0 +1,113 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateOne-hint +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.2.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_updateone_hint +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 22 +tests: + - + description: 'UpdateOne with hint string' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: &filter + _id: + $gt: 1 + update: &update + $inc: + x: 1 + hint: _id_ + expectResult: &result + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: _id_ + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: &outcome + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 11 + - + _id: 2 + x: 23 + - + description: 'UpdateOne with hint document' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: *filter + update: *update + hint: + _id: 1 + expectResult: *result + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: *filter + u: *update + hint: + _id: 1 + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + outcome: *outcome diff --git a/test/spec/crud/unified/updateOne-validation.json b/test/spec/crud/unified/updateOne-validation.json new file mode 100644 index 00000000000..1464642c59c --- /dev/null +++ b/test/spec/crud/unified/updateOne-validation.json @@ -0,0 +1,80 @@ +{ + "description": "updateOne-validation", + "schemaVersion": "1.0", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne requires atomic modifiers", + "operations": [ + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "x": 22 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateOne-validation.yml b/test/spec/crud/unified/updateOne-validation.yml new file mode 100644 index 00000000000..b6f49a65683 --- /dev/null +++ b/test/spec/crud/unified/updateOne-validation.yml @@ -0,0 +1,37 @@ +description: "updateOne-validation" + +schemaVersion: "1.0" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + +initialData: &initialData + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + +tests: + - description: "UpdateOne requires atomic modifiers" + operations: + - name: updateOne + object: *collection0 + arguments: + filter: { _id: 1 } + update: { x: 22 } + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: *initialData diff --git a/test/spec/crud/unified/updateWithPipelines.json b/test/spec/crud/unified/updateWithPipelines.json new file mode 100644 index 00000000000..164f2f6a199 --- /dev/null +++ b/test/spec/crud/unified/updateWithPipelines.json @@ -0,0 +1,494 @@ +{ + "description": "updateWithPipelines", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "4.1.11" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test" + } + } + ], + "initialData": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "y": 1, + "t": { + "u": { + "v": 1 + } + } + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ], + "tests": [ + { + "description": "UpdateOne using pipelines", + "operations": [ + { + "object": "collection0", + "name": "updateOne", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "u": { + "v": 1 + }, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateMany using pipelines", + "operations": [ + { + "object": "collection0", + "name": "updateMany", + "arguments": { + "filter": {}, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "foo": 1 + } + ] + } + ] + }, + { + "description": "FindOneAndUpdate using pipelines", + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "test", + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + }, + "commandName": "findAndModify", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateOne in bulk write using pipelines", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateOne": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ] + }, + "expectResult": { + "matchedCount": 1, + "modifiedCount": 1, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": [ + { + "$replaceRoot": { + "newRoot": "$t" + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "u": { + "v": 1 + }, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "y": 1 + } + ] + } + ] + }, + { + "description": "UpdateMany in bulk write using pipelines", + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "updateMany": { + "filter": {}, + "update": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ] + } + } + ] + }, + "expectResult": { + "matchedCount": 2, + "modifiedCount": 2, + "upsertedCount": 0 + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "test", + "updates": [ + { + "q": {}, + "u": [ + { + "$project": { + "x": 1 + } + }, + { + "$addFields": { + "foo": 1 + } + } + ], + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ] + }, + "commandName": "update", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "test", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 1, + "foo": 1 + }, + { + "_id": 2, + "x": 2, + "foo": 1 + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/updateWithPipelines.yml b/test/spec/crud/unified/updateWithPipelines.yml new file mode 100644 index 00000000000..4984dba24f2 --- /dev/null +++ b/test/spec/crud/unified/updateWithPipelines.yml @@ -0,0 +1,305 @@ +# This file was created automatically using mongodb-spec-converter. +# Please review the generated file, then remove this notice. + +description: updateWithPipelines +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: 4.1.11 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-tests + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test +initialData: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + 'y': 1 + t: + u: + v: 1 + - + _id: 2 + x: 2 + 'y': 1 +tests: + - + description: 'UpdateOne using pipelines' + operations: + - + object: *collection0 + name: updateOne + arguments: + filter: + _id: 1 + update: + - + $replaceRoot: + newRoot: $t + - + $addFields: + foo: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + - { $replaceRoot: { newRoot: $t } } + - { $addFields: { foo: 1 } } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + u: + v: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateMany using pipelines' + operations: + - + object: *collection0 + name: updateMany + arguments: + filter: { } + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + - { $project: { x: 1 } } + - { $addFields: { foo: 1 } } + multi: true + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + foo: 1 + - + description: 'FindOneAndUpdate using pipelines' + operations: + - + object: *collection0 + name: findOneAndUpdate + arguments: + filter: + _id: 1 + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + findAndModify: *collection_name + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + commandName: findAndModify + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateOne in bulk write using pipelines' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateOne: + filter: + _id: 1 + update: + - + $replaceRoot: + newRoot: $t + - + $addFields: + foo: 1 + expectResult: + matchedCount: 1 + modifiedCount: 1 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: + _id: 1 + u: + - { $replaceRoot: { newRoot: $t } } + - { $addFields: { foo: 1 } } + multi: + $$unsetOrMatches: false + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + u: + v: 1 + foo: 1 + - + _id: 2 + x: 2 + 'y': 1 + - + description: 'UpdateMany in bulk write using pipelines' + operations: + - + object: *collection0 + name: bulkWrite + arguments: + requests: + - + updateMany: + filter: { } + update: + - + $project: + x: 1 + - + $addFields: + foo: 1 + expectResult: + matchedCount: 2 + modifiedCount: 2 + upsertedCount: 0 + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + update: *collection_name + updates: + - + q: { } + u: + - { $project: { x: 1 } } + - { $addFields: { foo: 1 } } + multi: true + upsert: + $$unsetOrMatches: false + commandName: update + databaseName: *database_name + outcome: + - + collectionName: *collection_name + databaseName: *database_name + documents: + - + _id: 1 + x: 1 + foo: 1 + - + _id: 2 + x: 2 + foo: 1 diff --git a/test/spec/crud/v1/read/aggregate-collation.json b/test/spec/crud/v1/read/aggregate-collation.json index 85662a442fb..d958e447bfc 100644 --- a/test/spec/crud/v1/read/aggregate-collation.json +++ b/test/spec/crud/v1/read/aggregate-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Aggregate with collation", diff --git a/test/spec/crud/v1/read/aggregate-collation.yml b/test/spec/crud/v1/read/aggregate-collation.yml index d526db6d126..24cafd24bf2 100644 --- a/test/spec/crud/v1/read/aggregate-collation.yml +++ b/test/spec/crud/v1/read/aggregate-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: pipeline: - $match: x: 'PING' - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: - {_id: 1, x: 'ping'} diff --git a/test/spec/crud/v1/read/aggregate-out.json b/test/spec/crud/v1/read/aggregate-out.json index 4e33f9288f0..c195e163e00 100644 --- a/test/spec/crud/v1/read/aggregate-out.json +++ b/test/spec/crud/v1/read/aggregate-out.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "2.6", + "serverless": "forbid", "tests": [ { "description": "Aggregate with $out", diff --git a/test/spec/crud/v1/read/aggregate-out.yml b/test/spec/crud/v1/read/aggregate-out.yml index 893b7fe44b1..d6688dd08de 100644 --- a/test/spec/crud/v1/read/aggregate-out.yml +++ b/test/spec/crud/v1/read/aggregate-out.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 22} - {_id: 3, x: 33} minServerVersion: '2.6' +serverless: 'forbid' tests: - diff --git a/test/spec/crud/v1/read/count-collation.json b/test/spec/crud/v1/read/count-collation.json index 6f75282fe0f..7d61508493c 100644 --- a/test/spec/crud/v1/read/count-collation.json +++ b/test/spec/crud/v1/read/count-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Count documents with collation", diff --git a/test/spec/crud/v1/read/count-collation.yml b/test/spec/crud/v1/read/count-collation.yml index a463a7aa03e..02da74c6b09 100644 --- a/test/spec/crud/v1/read/count-collation.yml +++ b/test/spec/crud/v1/read/count-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'PING'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -9,7 +10,7 @@ tests: name: countDocuments arguments: filter: { x: 'ping' } - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: 1 diff --git a/test/spec/crud/v1/read/distinct-collation.json b/test/spec/crud/v1/read/distinct-collation.json index 0af0c67cb70..984991a43b9 100644 --- a/test/spec/crud/v1/read/distinct-collation.json +++ b/test/spec/crud/v1/read/distinct-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Distinct with a collation", diff --git a/test/spec/crud/v1/read/distinct-collation.yml b/test/spec/crud/v1/read/distinct-collation.yml index 08bd6a92922..33b57d9927c 100644 --- a/test/spec/crud/v1/read/distinct-collation.yml +++ b/test/spec/crud/v1/read/distinct-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, string: 'PING'} - {_id: 2, string: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -10,7 +11,7 @@ tests: name: distinct arguments: fieldName: "string" - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/test/spec/crud/v1/read/find-collation.json b/test/spec/crud/v1/read/find-collation.json index 53d0e94900d..4e56c05253a 100644 --- a/test/spec/crud/v1/read/find-collation.json +++ b/test/spec/crud/v1/read/find-collation.json @@ -6,6 +6,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "Find with a collation", diff --git a/test/spec/crud/v1/read/find-collation.yml b/test/spec/crud/v1/read/find-collation.yml index a014dc2510c..baac5add496 100644 --- a/test/spec/crud/v1/read/find-collation.yml +++ b/test/spec/crud/v1/read/find-collation.yml @@ -1,6 +1,7 @@ data: - {_id: 1, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -9,7 +10,7 @@ tests: name: "find" arguments: filter: {x: 'PING'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: - {_id: 1, x: 'ping'} diff --git a/test/spec/crud/v1/write/bulkWrite-collation.json b/test/spec/crud/v1/write/bulkWrite-collation.json index 8e9d1bcb1ac..bc90aa8172f 100644 --- a/test/spec/crud/v1/write/bulkWrite-collation.json +++ b/test/spec/crud/v1/write/bulkWrite-collation.json @@ -22,6 +22,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "BulkWrite with delete operations and collation", diff --git a/test/spec/crud/v1/write/bulkWrite-collation.yml b/test/spec/crud/v1/write/bulkWrite-collation.yml index 217c6911662..5aff22eed18 100644 --- a/test/spec/crud/v1/write/bulkWrite-collation.yml +++ b/test/spec/crud/v1/write/bulkWrite-collation.yml @@ -6,8 +6,9 @@ data: - {_id: 5, x: 'pONg'} minServerVersion: '3.4' +serverless: 'forbid' -# See: https://docs.mongodb.com/master/reference/collation/#collation-document +# See: https://docs.mongodb.com/manual/reference/collation/#collation-document tests: - description: "BulkWrite with delete operations and collation" diff --git a/test/spec/crud/v1/write/deleteMany-collation.json b/test/spec/crud/v1/write/deleteMany-collation.json index d17bf3bcb9e..fce75e488a9 100644 --- a/test/spec/crud/v1/write/deleteMany-collation.json +++ b/test/spec/crud/v1/write/deleteMany-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "DeleteMany when many documents match with collation", diff --git a/test/spec/crud/v1/write/deleteMany-collation.yml b/test/spec/crud/v1/write/deleteMany-collation.yml index daca5dd4c29..2b0ef9db944 100644 --- a/test/spec/crud/v1/write/deleteMany-collation.yml +++ b/test/spec/crud/v1/write/deleteMany-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -12,7 +13,7 @@ tests: arguments: filter: x: 'PING' - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/test/spec/crud/v1/write/deleteOne-collation.json b/test/spec/crud/v1/write/deleteOne-collation.json index 2f7f9211300..9bcef411ef7 100644 --- a/test/spec/crud/v1/write/deleteOne-collation.json +++ b/test/spec/crud/v1/write/deleteOne-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "DeleteOne when many documents matches with collation", diff --git a/test/spec/crud/v1/write/deleteOne-collation.yml b/test/spec/crud/v1/write/deleteOne-collation.yml index 321a1488561..d37ecf76de1 100644 --- a/test/spec/crud/v1/write/deleteOne-collation.yml +++ b/test/spec/crud/v1/write/deleteOne-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: name: "deleteOne" arguments: filter: {x: 'PING'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/test/spec/crud/v1/write/findOneAndDelete-collation.json b/test/spec/crud/v1/write/findOneAndDelete-collation.json index 1ff37d2e88a..32480da842d 100644 --- a/test/spec/crud/v1/write/findOneAndDelete-collation.json +++ b/test/spec/crud/v1/write/findOneAndDelete-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndDelete when one document matches with collation", diff --git a/test/spec/crud/v1/write/findOneAndDelete-collation.yml b/test/spec/crud/v1/write/findOneAndDelete-collation.yml index d33741f5737..5f13b7e5b73 100644 --- a/test/spec/crud/v1/write/findOneAndDelete-collation.yml +++ b/test/spec/crud/v1/write/findOneAndDelete-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -13,11 +14,11 @@ tests: filter: {_id: 2, x: 'PING'} projection: {x: 1, _id: 0} sort: {x: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'ping'} collection: data: - {_id: 1, x: 11} - - {_id: 3, x: 'pINg'} \ No newline at end of file + - {_id: 3, x: 'pINg'} diff --git a/test/spec/crud/v1/write/findOneAndReplace-collation.json b/test/spec/crud/v1/write/findOneAndReplace-collation.json index babb2f7c11f..9b3c25005b4 100644 --- a/test/spec/crud/v1/write/findOneAndReplace-collation.json +++ b/test/spec/crud/v1/write/findOneAndReplace-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndReplace when one document matches with collation returning the document after modification", diff --git a/test/spec/crud/v1/write/findOneAndReplace-collation.yml b/test/spec/crud/v1/write/findOneAndReplace-collation.yml index 040661d7527..206ac829c83 100644 --- a/test/spec/crud/v1/write/findOneAndReplace-collation.yml +++ b/test/spec/crud/v1/write/findOneAndReplace-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -14,7 +15,7 @@ tests: projection: {x: 1, _id: 0} returnDocument: After sort: {x: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'pong'} diff --git a/test/spec/crud/v1/write/findOneAndUpdate-collation.json b/test/spec/crud/v1/write/findOneAndUpdate-collation.json index 04c1fe73ec5..8abab7bd6bc 100644 --- a/test/spec/crud/v1/write/findOneAndUpdate-collation.json +++ b/test/spec/crud/v1/write/findOneAndUpdate-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "FindOneAndUpdate when many documents match with collation returning the document before modification", diff --git a/test/spec/crud/v1/write/findOneAndUpdate-collation.yml b/test/spec/crud/v1/write/findOneAndUpdate-collation.yml index 201f2751c3f..1c50e86be81 100644 --- a/test/spec/crud/v1/write/findOneAndUpdate-collation.yml +++ b/test/spec/crud/v1/write/findOneAndUpdate-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -16,7 +17,7 @@ tests: $set: {x: 'pong'} projection: {x: 1, _id: 0} sort: {_id: 1} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: {x: 'ping'} @@ -24,4 +25,4 @@ tests: data: - {_id: 1, x: 11} - {_id: 2, x: 'pong'} - - {_id: 3, x: 'pINg'} \ No newline at end of file + - {_id: 3, x: 'pINg'} diff --git a/test/spec/crud/v1/write/replaceOne-collation.json b/test/spec/crud/v1/write/replaceOne-collation.json index a668fe73831..fa4cbe99707 100644 --- a/test/spec/crud/v1/write/replaceOne-collation.json +++ b/test/spec/crud/v1/write/replaceOne-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "ReplaceOne when one document matches with collation", diff --git a/test/spec/crud/v1/write/replaceOne-collation.yml b/test/spec/crud/v1/write/replaceOne-collation.yml index 6861092bbb3..715cdce8441 100644 --- a/test/spec/crud/v1/write/replaceOne-collation.yml +++ b/test/spec/crud/v1/write/replaceOne-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -11,7 +12,7 @@ tests: arguments: filter: {x: 'PING'} replacement: {_id: 2, x: 'pong'} - collation: {locale: 'en_US', strength: 2} # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: {locale: 'en_US', strength: 2} # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: @@ -21,4 +22,4 @@ tests: collection: data: - {_id: 1, x: 11} - - {_id: 2, x: 'pong'} \ No newline at end of file + - {_id: 2, x: 'pong'} diff --git a/test/spec/crud/v1/write/updateMany-collation.json b/test/spec/crud/v1/write/updateMany-collation.json index 3cb49f22981..8becfd806bd 100644 --- a/test/spec/crud/v1/write/updateMany-collation.json +++ b/test/spec/crud/v1/write/updateMany-collation.json @@ -14,6 +14,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "UpdateMany when many documents match with collation", diff --git a/test/spec/crud/v1/write/updateMany-collation.yml b/test/spec/crud/v1/write/updateMany-collation.yml index 2d48a9dcfe4..5a7048f09a9 100644 --- a/test/spec/crud/v1/write/updateMany-collation.yml +++ b/test/spec/crud/v1/write/updateMany-collation.yml @@ -3,6 +3,7 @@ data: - {_id: 2, x: 'ping'} - {_id: 3, x: 'pINg'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -14,7 +15,7 @@ tests: x: 'ping' update: $set: {x: 'pong'} - collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2 } # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/test/spec/crud/v1/write/updateOne-collation.json b/test/spec/crud/v1/write/updateOne-collation.json index c49112d519c..3afdb83e0f4 100644 --- a/test/spec/crud/v1/write/updateOne-collation.json +++ b/test/spec/crud/v1/write/updateOne-collation.json @@ -10,6 +10,7 @@ } ], "minServerVersion": "3.4", + "serverless": "forbid", "tests": [ { "description": "UpdateOne when one document matches with collation", diff --git a/test/spec/crud/v1/write/updateOne-collation.yml b/test/spec/crud/v1/write/updateOne-collation.yml index 468e9467427..0132152b09e 100644 --- a/test/spec/crud/v1/write/updateOne-collation.yml +++ b/test/spec/crud/v1/write/updateOne-collation.yml @@ -2,6 +2,7 @@ data: - {_id: 1, x: 11} - {_id: 2, x: 'ping'} minServerVersion: '3.4' +serverless: 'forbid' tests: - @@ -12,7 +13,7 @@ tests: filter: {x: 'PING'} update: $set: {x: 'pong'} - collation: { locale: 'en_US', strength: 2} # https://docs.mongodb.com/master/reference/collation/#collation-document + collation: { locale: 'en_US', strength: 2} # https://docs.mongodb.com/manual/reference/collation/#collation-document outcome: result: diff --git a/test/spec/crud/v2/aggregate-merge.json b/test/spec/crud/v2/aggregate-merge.json deleted file mode 100644 index c61736a0bbf..00000000000 --- a/test/spec/crud/v2/aggregate-merge.json +++ /dev/null @@ -1,415 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.11" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_aggregate_merge", - "tests": [ - { - "description": "Aggregate with $merge", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and batch size of 0", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "batchSize": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "cursor": {} - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and majority readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and local readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "local" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Aggregate with $merge and available readConcern", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "available" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/aggregate-merge.yml b/test/spec/crud/v2/aggregate-merge.yml deleted file mode 100644 index 5bc5c68acdb..00000000000 --- a/test/spec/crud/v2/aggregate-merge.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - - minServerVersion: "4.1.11" - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'test_aggregate_merge' - -tests: - - - description: "Aggregate with $merge" - operations: - - - object: collection - name: aggregate - arguments: &arguments - pipeline: &pipeline - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $merge: { into: &output_collection "other_test_collection" } - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - outcome: &outcome - collection: - name: *output_collection - data: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "Aggregate with $merge and batch size of 0" - operations: - - - object: collection - name: aggregate - arguments: - <<: *arguments - batchSize: 0 - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - cursor: {} - outcome: *outcome - - - description: "Aggregate with $merge and majority readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "majority" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "majority" } - outcome: *outcome - - - description: "Aggregate with $merge and local readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "local" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "local" } - outcome: *outcome - - - description: "Aggregate with $merge and available readConcern" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "available" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "available" } - outcome: *outcome diff --git a/test/spec/crud/v2/aggregate-out-readConcern.json b/test/spec/crud/v2/aggregate-out-readConcern.json deleted file mode 100644 index c39ee0e2815..00000000000 --- a/test/spec/crud/v2/aggregate-out-readConcern.json +++ /dev/null @@ -1,385 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.0", - "topology": [ - "replicaset", - "sharded" - ] - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_aggregate_out_readconcern", - "tests": [ - { - "description": "readConcern majority with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern local with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "local" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern available with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "available" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ], - "outcome": { - "collection": { - "name": "other_test_collection", - "data": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "readConcern linearizable with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "linearizable" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "linearizable" - } - } - } - } - ] - }, - { - "description": "invalid readConcern with out stage", - "operations": [ - { - "object": "collection", - "name": "aggregate", - "collectionOptions": { - "readConcern": { - "level": "!invalid123" - } - }, - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "!invalid123" - } - } - } - } - ] - } - ] -} diff --git a/test/spec/crud/v2/aggregate-out-readConcern.yml b/test/spec/crud/v2/aggregate-out-readConcern.yml deleted file mode 100644 index 0a864f05e77..00000000000 --- a/test/spec/crud/v2/aggregate-out-readConcern.yml +++ /dev/null @@ -1,110 +0,0 @@ -runOn: - - - minServerVersion: "4.1.0" - topology: ["replicaset", "sharded"] - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'test_aggregate_out_readconcern' - -tests: - - - description: "readConcern majority with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "majority" } - arguments: &arguments - pipeline: - - $sort: { x : 1 } - - $match: { _id: { $gt: 1 } } - - $out: &output_collection "other_test_collection" - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: &pipeline - - $sort: { x: 1 } - - $match: { _id: { $gt: 1 } } - - $out: "other_test_collection" - readConcern: { level: "majority" } - outcome: &outcome - collection: - name: *output_collection - data: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "readConcern local with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "local" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "local" } - outcome: *outcome - - - description: "readConcern available with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "available" } - arguments: *arguments - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "available" } - outcome: *outcome - - - description: "readConcern linearizable with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "linearizable" } - arguments: *arguments - error: true - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "linearizable" } - - - description: "invalid readConcern with out stage" - operations: - - - object: collection - name: aggregate - collectionOptions: - readConcern: { level: "!invalid123" } - arguments: *arguments - error: true - expectations: - - - command_started_event: - command: - aggregate: *collection_name - pipeline: *pipeline - readConcern: { level: "!invalid123" } diff --git a/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml b/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml deleted file mode 100644 index 0421ab33e6e..00000000000 --- a/test/spec/crud/v2/bulkWrite-arrayFilters-clientError.yml +++ /dev/null @@ -1,50 +0,0 @@ -runOn: - - - # arrayFilters support first introduced in 3.5.6 - maxServerVersion: "3.5.5" - -data: - - {_id: 1, y: [{b: 3}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - -tests: - - - description: "BulkWrite on server that doesn't support arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne with with arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.0.b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - error: true - expectations: [] - - - description: "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne with no arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.0.b": 2 } } - - - # UpdateMany with arrayFilters - name: "updateMany" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - error: true - expectations: [] diff --git a/test/spec/crud/v2/bulkWrite-arrayFilters.json b/test/spec/crud/v2/bulkWrite-arrayFilters.json deleted file mode 100644 index 2d3ce96de17..00000000000 --- a/test/spec/crud/v2/bulkWrite-arrayFilters.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.5.6" - } - ], - "data": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ], - "collection_name": "test", - "database_name": "crud-tests", - "tests": [ - { - "description": "BulkWrite updateOne with arrayFilters", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - ], - "ordered": true - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - } - }, - { - "description": "BulkWrite updateMany with arrayFilters", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "multi": true, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - ], - "ordered": true - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 2 - } - ] - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/bulkWrite-arrayFilters.yml b/test/spec/crud/v2/bulkWrite-arrayFilters.yml deleted file mode 100644 index b3e32e6aa40..00000000000 --- a/test/spec/crud/v2/bulkWrite-arrayFilters.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - - minServerVersion: "3.5.6" - -data: - - {_id: 1, y: [{b: 3}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - -collection_name: &collection_name "test" -database_name: &database_name "crud-tests" - -tests: - - - description: "BulkWrite updateOne with arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateOne when one document matches arrayFilters - name: "updateOne" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 3 } ] - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: {} - u: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 3 } ] - ordered: true - # TODO: check that these fields do not exist once - # https://jira.mongodb.org/browse/SPEC-1215 has been resolved. - # writeConcern: null - # bypassDocumentValidation: null - command_name: update - database_name: *database_name - outcome: - collection: - data: - - {_id: 1, y: [{b: 2}, {b: 1}]} - - {_id: 2, y: [{b: 0}, {b: 1}]} - - - description: "BulkWrite updateMany with arrayFilters" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - # UpdateMany when multiple documents match arrayFilters - name: "updateMany" - arguments: - filter: {} - update: { $set: { "y.$[i].b": 2 } } - arrayFilters: [ { "i.b": 1 } ] - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: {} - u: { $set: { "y.$[i].b": 2 } } - multi: true - arrayFilters: [ { "i.b": 1 } ] - ordered: true - # TODO: check that these fields do not exist once - # https://jira.mongodb.org/browse/SPEC-1215 has been resolved. - # writeConcern: null - # bypassDocumentValidation: null - command_name: update - database_name: *database_name - outcome: - collection: - data: - - {_id: 1, y: [{b: 3}, {b: 2}]} - - {_id: 2, y: [{b: 0}, {b: 2}]} diff --git a/test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml b/test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index bbd1a0be51c..00000000000 --- a/test/spec/crud/v2/bulkWrite-delete-hint-clientError.yml +++ /dev/null @@ -1,63 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite deleteMany with hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/bulkWrite-delete-hint-serverError.json b/test/spec/crud/v2/bulkWrite-delete-hint-serverError.json deleted file mode 100644 index c68973b0f68..00000000000 --- a/test/spec/crud/v2/bulkWrite-delete-hint-serverError.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "collection_name": "BulkWrite_delete_hint", - "tests": [ - { - "description": "BulkWrite deleteOne with hints unsupported (server-side error)", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 2 - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - }, - { - "q": { - "_id": 2 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite deleteMany with hints unsupported (server-side error)", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_" - } - }, - { - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_", - "limit": 0 - }, - { - "q": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml b/test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml deleted file mode 100644 index 72d32dd4245..00000000000 --- a/test/spec/crud/v2/bulkWrite-delete-hint-serverError.yml +++ /dev/null @@ -1,92 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteOne options, and server versions >= 4.3.4 - # support the hint option in deleteOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.3.3" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteOne_filter1 - hint: *hint_string - limit: 1 - - - q: *deleteOne_filter2 - hint: *hint_doc - limit: 1 - ordered: true - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite deleteMany with hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteMany_filter1 - hint: *hint_string - limit: 0 - - - q: *deleteMany_filter2 - hint: *hint_doc - limit: 0 - ordered: true - outcome: *outcome diff --git a/test/spec/crud/v2/bulkWrite-delete-hint.json b/test/spec/crud/v2/bulkWrite-delete-hint.json deleted file mode 100644 index ece3238fc3c..00000000000 --- a/test/spec/crud/v2/bulkWrite-delete-hint.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "collection_name": "BulkWrite_delete_hint", - "tests": [ - { - "description": "BulkWrite deleteOne with hints", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 2 - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 2, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - }, - { - "q": { - "_id": 2 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite deleteMany with hints", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_" - } - }, - { - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 3, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_", - "limit": 0 - }, - { - "q": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/bulkWrite-delete-hint.yml b/test/spec/crud/v2/bulkWrite-delete-hint.yml deleted file mode 100644 index 671c531e710..00000000000 --- a/test/spec/crud/v2/bulkWrite-delete-hint.yml +++ /dev/null @@ -1,103 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "BulkWrite deleteOne with hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - result: - deletedCount: 2 - insertedCount: 0 - insertedIds: {} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteOne_filter1 - hint: *hint_string - limit: 1 - - - q: *deleteOne_filter2 - hint: *hint_doc - limit: 1 - ordered: true - outcome: - collection: - data: - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite deleteMany with hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 3 - insertedCount: 0 - insertedIds: {} - matchedCount: 0 - modifiedCount: 0 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *deleteMany_filter1 - hint: *hint_string - limit: 0 - - - q: *deleteMany_filter2 - hint: *hint_doc - limit: 0 - ordered: true - outcome: - collection: - data: - - {_id: 3, x: 33 } diff --git a/test/spec/crud/v2/bulkWrite-update-hint-clientError.yml b/test/spec/crud/v2/bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 9b92b63b84f..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-hint-clientError.yml +++ /dev/null @@ -1,90 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'test_bulkwrite_update_hint' - -tests: - - - description: "BulkWrite updateOne with update hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite updateMany with update hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome - - - description: "BulkWrite replaceOne with update hints unsupported (client-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/bulkWrite-update-hint-serverError.json b/test/spec/crud/v2/bulkWrite-update-hint-serverError.json deleted file mode 100644 index e8b96fffebf..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-hint-serverError.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "collection_name": "test_bulkwrite_update_hint", - "tests": [ - { - "description": "BulkWrite updateOne with update hints unsupported (server-side error)", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite updateMany with update hints unsupported (server-side error)", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - }, - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite replaceOne with update hints unsupported (server-side error)", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 333 - }, - "hint": "_id_" - } - }, - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "x": 333 - }, - "hint": "_id_" - }, - { - "q": { - "_id": 4 - }, - "u": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/bulkWrite-update-hint-serverError.yml b/test/spec/crud/v2/bulkWrite-update-hint-serverError.yml deleted file mode 100644 index 8412b6dd947..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-hint-serverError.yml +++ /dev/null @@ -1,147 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateOne options, and server versions >= 4.2.0 - # support the hint option in updateOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.1.9" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'test_bulkwrite_update_hint' - -tests: - - - description: "BulkWrite updateOne with update hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_string - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite updateMany with update hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_string - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite replaceOne with update hints unsupported (server-side error)" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 3 } - u: { x: 333 } - hint: *hint_string - - - q: { _id: 4 } - u: { x: 444 } - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } diff --git a/test/spec/crud/v2/bulkWrite-update-hint.json b/test/spec/crud/v2/bulkWrite-update-hint.json deleted file mode 100644 index 15e169f76c9..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-hint.json +++ /dev/null @@ -1,366 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "collection_name": "test_bulkwrite_update_hint", - "tests": [ - { - "description": "BulkWrite updateOne with update hints", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 13 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite updateMany with update hints", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 4, - "modifiedCount": 4, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - }, - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 13 - }, - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - } - }, - { - "description": "BulkWrite replaceOne with update hints", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 333 - }, - "hint": "_id_" - } - }, - { - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - } - ], - "options": { - "ordered": true - } - }, - "result": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": {}, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "x": 333 - }, - "hint": "_id_" - }, - { - "q": { - "_id": 4 - }, - "u": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 333 - }, - { - "_id": 4, - "x": 444 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/bulkWrite-update-hint.yml b/test/spec/crud/v2/bulkWrite-update-hint.yml deleted file mode 100644 index 0d60a56b6fb..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-hint.yml +++ /dev/null @@ -1,164 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'test_bulkwrite_update_hint' - -tests: - - - description: "BulkWrite updateOne with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_string - - - q: *updateOne_filter - u: *updateOne_update - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 13 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite updateMany with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 4 - modifiedCount: 4 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_string - - - q: *updateMany_filter - u: *updateMany_update - multi: true - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 13 } - - {_id: 2, x: 24 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "BulkWrite replaceOne with update hints" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - result: - deletedCount: 0 - insertedCount: 0 - insertedIds: {} - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - upsertedIds: {} - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 3 } - u: { x: 333 } - hint: *hint_string - - - q: { _id: 4 } - u: { x: 444 } - hint: *hint_doc - ordered: true - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 333 } - - {_id: 4, x: 444 } diff --git a/test/spec/crud/v2/bulkWrite-update-validation.yml b/test/spec/crud/v2/bulkWrite-update-validation.yml deleted file mode 100644 index ac11f18b226..00000000000 --- a/test/spec/crud/v2/bulkWrite-update-validation.yml +++ /dev/null @@ -1,75 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -tests: - - - description: "BulkWrite replaceOne prohibits atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - replacement: { $set: { x: 22 }} - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - - description: "BulkWrite updateOne requires atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - update: { x: 22 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - - description: "BulkWrite updateMany requires atomic modifiers" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: { _id: { $gt: 1 }} - # Only the first field is tested, as the spec permits drivers to - # only check that and rely on the server to check subsequent - # fields. - update: { x: 44 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } diff --git a/test/spec/crud/v2/db-aggregate.yml b/test/spec/crud/v2/db-aggregate.yml deleted file mode 100644 index e9a814858db..00000000000 --- a/test/spec/crud/v2/db-aggregate.yml +++ /dev/null @@ -1,38 +0,0 @@ -runOn: - - - minServerVersion: "3.6.0" - -database_name: &database_name "admin" - -tests: - - - description: "Aggregate with $listLocalSessions" - operations: - - - name: aggregate - object: database - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1} - result: - - - dummy: "dummy field" - - - description: "Aggregate with $listLocalSessions and allowDiskUse" - operations: - - - name: aggregate - object: database - arguments: - pipeline: - - $listLocalSessions: { } - - $limit: 1 - - $addFields: { dummy: "dummy field"} - - $project: { _id: 0, dummy: 1 } - allowDiskUse: true - result: - - - dummy: "dummy field" diff --git a/test/spec/crud/v2/deleteMany-hint-clientError.json b/test/spec/crud/v2/deleteMany-hint-clientError.json deleted file mode 100644 index 3a0d02566b6..00000000000 --- a/test/spec/crud/v2/deleteMany-hint-clientError.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.3.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "DeleteMany_hint", - "tests": [ - { - "description": "DeleteMany with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "DeleteMany with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteMany-hint-clientError.yml b/test/spec/crud/v2/deleteMany-hint-clientError.yml deleted file mode 100644 index fc5f5554787..00000000000 --- a/test/spec/crud/v2/deleteMany-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteMany options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string unsupported (client-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "DeleteMany with hint document unsupported (client-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/deleteMany-hint-serverError.json b/test/spec/crud/v2/deleteMany-hint-serverError.json deleted file mode 100644 index 5829e86df89..00000000000 --- a/test/spec/crud/v2/deleteMany-hint-serverError.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "DeleteMany_hint", - "tests": [ - { - "description": "DeleteMany with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_", - "limit": 0 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "DeleteMany with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteMany-hint-serverError.yml b/test/spec/crud/v2/deleteMany-hint-serverError.yml deleted file mode 100644 index b21736091a9..00000000000 --- a/test/spec/crud/v2/deleteMany-hint-serverError.yml +++ /dev/null @@ -1,62 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteMany options, and server versions >= 4.3.4 - # support the hint option in deleteMany. - - { minServerVersion: "3.4.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string unsupported (server-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 0 - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "DeleteMany with hint document unsupported (server-side error)" - operations: - - - object: collection - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 0 - outcome: *outcome diff --git a/test/spec/crud/v2/deleteMany-hint.json b/test/spec/crud/v2/deleteMany-hint.json deleted file mode 100644 index 51ee3860664..00000000000 --- a/test/spec/crud/v2/deleteMany-hint.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "DeleteMany_hint", - "tests": [ - { - "description": "DeleteMany with hint string", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "result": { - "deletedCount": 2 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_", - "limit": 0 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - }, - { - "description": "DeleteMany with hint document", - "operations": [ - { - "object": "collection", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "deletedCount": 2 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteMany-hint.yml b/test/spec/crud/v2/deleteMany-hint.yml deleted file mode 100644 index d1d25cff1a8..00000000000 --- a/test/spec/crud/v2/deleteMany-hint.yml +++ /dev/null @@ -1,58 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "DeleteMany with hint string" - operations: - - - object: collection - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - result: &result - deletedCount: 2 - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 0 - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - - description: "DeleteMany with hint document" - operations: - - - object: collection - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 0 - outcome: *outcome - diff --git a/test/spec/crud/v2/deleteOne-hint-clientError.json b/test/spec/crud/v2/deleteOne-hint-clientError.json deleted file mode 100644 index 97f8ec4924a..00000000000 --- a/test/spec/crud/v2/deleteOne-hint-clientError.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.3.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "DeleteOne_hint", - "tests": [ - { - "description": "DeleteOne with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "DeleteOne with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteOne-hint-clientError.yml b/test/spec/crud/v2/deleteOne-hint-clientError.yml deleted file mode 100644 index cb65d5ff0da..00000000000 --- a/test/spec/crud/v2/deleteOne-hint-clientError.yml +++ /dev/null @@ -1,41 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # deleteOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string unsupported (client-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "DeleteOne with hint document unsupported (client-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/deleteOne-hint-serverError.json b/test/spec/crud/v2/deleteOne-hint-serverError.json deleted file mode 100644 index 3cf9400a88d..00000000000 --- a/test/spec/crud/v2/deleteOne-hint-serverError.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "DeleteOne_hint", - "tests": [ - { - "description": "DeleteOne with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "DeleteOne with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteOne-hint-serverError.yml b/test/spec/crud/v2/deleteOne-hint-serverError.yml deleted file mode 100644 index b0158fa0431..00000000000 --- a/test/spec/crud/v2/deleteOne-hint-serverError.yml +++ /dev/null @@ -1,60 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown deleteOne options, and server versions >= 4.3.4 - # support the hint option in deleteOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string unsupported (server-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 1 - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "DeleteOne with hint document unsupported (server-side error)" - operations: - - - object: collection - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 1 - outcome: *outcome diff --git a/test/spec/crud/v2/deleteOne-hint.json b/test/spec/crud/v2/deleteOne-hint.json deleted file mode 100644 index ec8e7715a29..00000000000 --- a/test/spec/crud/v2/deleteOne-hint.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "DeleteOne_hint", - "tests": [ - { - "description": "DeleteOne with hint string", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "deleteOne with hint document", - "operations": [ - { - "object": "collection", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/deleteOne-hint.yml b/test/spec/crud/v2/deleteOne-hint.yml deleted file mode 100644 index 939ff9e0644..00000000000 --- a/test/spec/crud/v2/deleteOne-hint.yml +++ /dev/null @@ -1,57 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "DeleteOne with hint string" - operations: - - - object: collection - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - result: &result - deletedCount: 1 - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: "_id_" - limit: 1 - outcome: &outcome - collection: - data: - - {_id: 2, x: 22 } - - - description: "deleteOne with hint document" - operations: - - - object: collection - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - delete: *collection_name - deletes: - - - q: *filter - hint: { _id: 1 } - limit: 1 - outcome: *outcome - diff --git a/test/spec/crud/v2/find-allowdiskuse-clientError.json b/test/spec/crud/v2/find-allowdiskuse-clientError.json deleted file mode 100644 index 5ea013966a1..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse-clientError.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.0.99" - } - ], - "collection_name": "test_find_allowdiskuse_clienterror", - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 3.2 server", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "error": true - } - ], - "expectations": [] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 3.2 server", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "error": true - } - ], - "expectations": [] - } - ] -} diff --git a/test/spec/crud/v2/find-allowdiskuse-clientError.yml b/test/spec/crud/v2/find-allowdiskuse-clientError.yml deleted file mode 100644 index d877b6259b4..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse-clientError.yml +++ /dev/null @@ -1,28 +0,0 @@ -runOn: - - { maxServerVersion: "3.0.99" } - -collection_name: &collection_name 'test_find_allowdiskuse_clienterror' - -tests: - - - description: "Find fails when allowDiskUse true is specified against pre 3.2 server" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: true - error: true - expectations: [] - - - description: "Find fails when allowDiskUse false is specified against pre 3.2 server" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: false - error: true - expectations: [] diff --git a/test/spec/crud/v2/find-allowdiskuse-serverError.json b/test/spec/crud/v2/find-allowdiskuse-serverError.json deleted file mode 100644 index 31aa50e9514..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse-serverError.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.2", - "maxServerVersion": "4.3.0" - } - ], - "collection_name": "test_find_allowdiskuse_servererror", - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": true - } - } - } - ] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": false - } - } - } - ] - } - ] -} diff --git a/test/spec/crud/v2/find-allowdiskuse-serverError.yml b/test/spec/crud/v2/find-allowdiskuse-serverError.yml deleted file mode 100644 index 729fbfd0b7b..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse-serverError.yml +++ /dev/null @@ -1,44 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.2.0 - # raise errors for unknown find options, and server versions >= 4.3.1 - # support the allowDiskUse option in find. - - { minServerVersion: "3.2", maxServerVersion: "4.3.0" } - -collection_name: &collection_name 'test_find_allowdiskuse_servererror' - -tests: - - - description: "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)" - operations: - - - object: collection - name: find - arguments: - filter: &filter { } - allowDiskUse: true - error: true - expectations: - - - command_started_event: - command: - find: *collection_name - filter: *filter - allowDiskUse: true - - - description: "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)" - operations: - - - object: collection - name: find - arguments: - filter: *filter - allowDiskUse: false - error: true - expectations: - - - command_started_event: - command: - find: *collection_name - filter: *filter - allowDiskUse: false diff --git a/test/spec/crud/v2/find-allowdiskuse.json b/test/spec/crud/v2/find-allowdiskuse.json deleted file mode 100644 index b2862563b9f..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "collection_name": "test_find_allowdiskuse", - "tests": [ - { - "description": "Find does not send allowDiskuse when value is not specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {} - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": null - } - } - } - ] - }, - { - "description": "Find sends allowDiskuse false when false is specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": false - } - } - } - ] - }, - { - "description": "Find sends allowDiskUse true when true is specified", - "operations": [ - { - "object": "collection", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": true - } - } - } - ] - } - ] -} diff --git a/test/spec/crud/v2/find-allowdiskuse.yml b/test/spec/crud/v2/find-allowdiskuse.yml deleted file mode 100644 index adfc0000eac..00000000000 --- a/test/spec/crud/v2/find-allowdiskuse.yml +++ /dev/null @@ -1,50 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -collection_name: &collection_name 'test_find_allowdiskuse' - -tests: - - - description: "Find does not send allowDiskuse when value is not specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: - - - description: "Find sends allowDiskuse false when false is specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: false - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: false - - - description: "Find sends allowDiskUse true when true is specified" - operations: - - - object: collection - name: find - arguments: - filter: { } - allowDiskUse: true - expectations: - - - command_started_event: - command: - find: *collection_name - allowDiskUse: true diff --git a/test/spec/crud/v2/findOneAndDelete-hint-clientError.json b/test/spec/crud/v2/findOneAndDelete-hint-clientError.json deleted file mode 100644 index 262e78ce750..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint-clientError.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndDelete_hint", - "tests": [ - { - "description": "FindOneAndDelete with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndDelete with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndDelete-hint-clientError.yml b/test/spec/crud/v2/findOneAndDelete-hint-clientError.yml deleted file mode 100644 index 338faba9daf..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint-clientError.yml +++ /dev/null @@ -1,45 +0,0 @@ -runOn: - # Server versions >= 4.2.0 will return an error response for unrecognized - # findAndMOdify options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 4.2. - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndDelete with hint document" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/test/spec/crud/v2/findOneAndDelete-hint-serverError.json b/test/spec/crud/v2/findOneAndDelete-hint-serverError.json deleted file mode 100644 index 9412b36f238..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint-serverError.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.3" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndDelete_hint", - "tests": [ - { - "description": "FindOneAndDelete with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": "_id_", - "remove": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndDelete with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "remove": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndDelete-hint-serverError.yml b/test/spec/crud/v2/findOneAndDelete-hint-serverError.yml deleted file mode 100644 index 305ea66eca9..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint-serverError.yml +++ /dev/null @@ -1,60 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 4.2.0 - # raise errors for unknown findOneAndModify options, and server versions >= 4.3.4 - # support the hint option in findOneAndModify when remove is true. - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.3" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: "_id_" - remove: true - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndDelete with hint document unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: { _id: 1 } - remove: true - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/test/spec/crud/v2/findOneAndDelete-hint.json b/test/spec/crud/v2/findOneAndDelete-hint.json deleted file mode 100644 index fe8dcfa4c55..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.4" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndDelete_hint", - "tests": [ - { - "description": "FindOneAndDelete with hint string", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": "_id_", - "remove": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndDelete with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "remove": true - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndDelete-hint.yml b/test/spec/crud/v2/findOneAndDelete-hint.yml deleted file mode 100644 index 9ae087d11b1..00000000000 --- a/test/spec/crud/v2/findOneAndDelete-hint.yml +++ /dev/null @@ -1,56 +0,0 @@ -runOn: - - { minServerVersion: "4.3.4" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "FindOneAndDelete with hint string" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: "_id_" - remove: true - outcome: &outcome - collection: - data: - - { _id: 2, x: 22 } - - - description: "FindOneAndDelete with hint document" - operations: - - - object: collection - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - hint: { _id: 1 } - remove: true - outcome: &outcome - collection: - data: - - { _id: 2, x: 22 } diff --git a/test/spec/crud/v2/findOneAndReplace-hint-clientError.json b/test/spec/crud/v2/findOneAndReplace-hint-clientError.json deleted file mode 100644 index 08fd4b3ecc0..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint-clientError.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndReplace with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndReplace-hint-clientError.yml b/test/spec/crud/v2/findOneAndReplace-hint-clientError.yml deleted file mode 100644 index f50782d3384..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -runOn: - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/findOneAndReplace-hint-serverError.json b/test/spec/crud/v2/findOneAndReplace-hint-serverError.json deleted file mode 100644 index 6710e6a70e8..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint-serverError.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndReplace with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndReplace-hint-serverError.yml b/test/spec/crud/v2/findOneAndReplace-hint-serverError.yml deleted file mode 100644 index 41812658a1b..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint-serverError.yml +++ /dev/null @@ -1,59 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 4.1.10 - # raise errors for unknown findAndModify options (SERVER-40005), but the spec - # requires client-side errors for < 4.2. Support for findAndModify hint was - # added in 4.3.1 (SERVER-42099), so we'll allow up to 4.3.0 (inclusive). - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.0" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/findOneAndReplace-hint.json b/test/spec/crud/v2/findOneAndReplace-hint.json deleted file mode 100644 index 263fdf96239..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndReplace_hint", - "tests": [ - { - "description": "FindOneAndReplace with hint string", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndReplace with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndReplace-hint.yml b/test/spec/crud/v2/findOneAndReplace-hint.yml deleted file mode 100644 index b585dd867b3..00000000000 --- a/test/spec/crud/v2/findOneAndReplace-hint.yml +++ /dev/null @@ -1,55 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndReplace_hint' - -tests: - - - description: "FindOneAndReplace with hint string" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 33 } - - { _id: 2, x: 22 } - - - description: "FindOneAndReplace with hint document" - operations: - - - object: collection - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/findOneAndUpdate-hint-clientError.json b/test/spec/crud/v2/findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 8cd5cddb51e..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint-clientError.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml b/test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index aec3e244d25..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -runOn: - - { maxServerVersion: "4.0.99" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document unsupported (client-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/findOneAndUpdate-hint-serverError.json b/test/spec/crud/v2/findOneAndUpdate-hint-serverError.json deleted file mode 100644 index 1f4b2bda8b6..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint-serverError.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml b/test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml deleted file mode 100644 index 06f788a62b1..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint-serverError.yml +++ /dev/null @@ -1,58 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Support for findAndModify - # hint was added in 4.3.1 (SERVER-42099), so we'll allow up to 4.3.0 - # (inclusive). - - { minServerVersion: "4.2.0", maxServerVersion: "4.3.0" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document unsupported (server-side error)" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/findOneAndUpdate-hint.json b/test/spec/crud/v2/findOneAndUpdate-hint.json deleted file mode 100644 index 451eecc0138..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.3.1" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndUpdate_hint", - "tests": [ - { - "description": "FindOneAndUpdate with hint string", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate with hint document", - "operations": [ - { - "object": "collection", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "x": 11 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/findOneAndUpdate-hint.yml b/test/spec/crud/v2/findOneAndUpdate-hint.yml deleted file mode 100644 index 36b169c2a1b..00000000000 --- a/test/spec/crud/v2/findOneAndUpdate-hint.yml +++ /dev/null @@ -1,55 +0,0 @@ -runOn: - - { minServerVersion: "4.3.1" } - -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndUpdate_hint' - -tests: - - - description: "FindOneAndUpdate with hint string" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - # original document is returned by default - result: &result { _id: 1, x: 11 } - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 12 } - - { _id: 2, x: 22 } - - - description: "FindOneAndUpdate with hint document" - operations: - - - object: collection - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - query: *filter - update: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/replaceOne-hint.json b/test/spec/crud/v2/replaceOne-hint.json deleted file mode 100644 index de4aa4d02f6..00000000000 --- a/test/spec/crud/v2/replaceOne-hint.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_replaceone_hint", - "tests": [ - { - "description": "ReplaceOne with hint string", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - } - }, - { - "description": "ReplaceOne with hint document", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/replaceOne-hint.yml b/test/spec/crud/v2/replaceOne-hint.yml deleted file mode 100644 index 8b418d1202b..00000000000 --- a/test/spec/crud/v2/replaceOne-hint.yml +++ /dev/null @@ -1,61 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_replaceone_hint' - -tests: - - - description: "ReplaceOne with hint string" - operations: - - - object: collection - name: replaceOne - arguments: - filter: &filter { _id: { $gt: 1 } } - replacement: &replacement {x: 111} - hint: "_id_" - result: &result - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *replacement - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 111 } - - - description: "ReplaceOne with hint document" - operations: - - - object: collection - name: replaceOne - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *replacement - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/replaceOne-validation.json b/test/spec/crud/v2/replaceOne-validation.json deleted file mode 100644 index 2de4a6728bd..00000000000 --- a/test/spec/crud/v2/replaceOne-validation.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - } - ], - "tests": [ - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/replaceOne-validation.yml b/test/spec/crud/v2/replaceOne-validation.yml deleted file mode 100644 index 60ac9894c43..00000000000 --- a/test/spec/crud/v2/replaceOne-validation.yml +++ /dev/null @@ -1,21 +0,0 @@ -data: - - { _id: 1, x: 11 } - -tests: - - - description: "ReplaceOne prohibits atomic modifiers" - operations: - - - object: collection - name: replaceOne - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - replacement: { $set: { x: 22 }} - error: true - expectations: [] - outcome: - collection: - data: - - { _id: 1, x: 11 } diff --git a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml deleted file mode 100644 index 7130aa1cf0c..00000000000 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-delete-hint-clientError.yml +++ /dev/null @@ -1,60 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'BulkWrite_delete_hint' - -tests: - - - description: "Unacknowledged bulkWrite deleteOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: &collection_options - writeConcern: { w: 0 } - arguments: - requests: - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter1 { _id: 1 } - hint: &hint_string "_id_" - - - name: "deleteOne" - arguments: - filter: &deleteOne_filter2 { _id: 2 } - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "Unacknowledged bulkWrite deleteMany with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter1 { _id: { $lt: 3 } } - hint: *hint_string - - - name: "deleteMany" - arguments: - filter: &deleteMany_filter2 { _id: { $gte: 4 } } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml deleted file mode 100644 index 2aecaa3099b..00000000000 --- a/test/spec/crud/v2/unacknowledged-bulkWrite-update-hint-clientError.yml +++ /dev/null @@ -1,88 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - {_id: 4, x: 44} - -collection_name: &collection_name 'Bulkwrite_update_hint' - -tests: - - - description: "Unacknowledged bulkWrite updateOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: &collection_options - writeConcern: { w: 0 } - arguments: - requests: - - - name: "updateOne" - arguments: - filter: &updateOne_filter { _id: 1 } - update: &updateOne_update { $inc: { x: 1 } } - hint: &hint_string "_id_" - - - name: "updateOne" - arguments: - filter: *updateOne_filter - update: *updateOne_update - hint: &hint_doc { _id: 1 } - options: { ordered: true } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - {_id: 3, x: 33 } - - {_id: 4, x: 44 } - - - description: "Unacknowledged bulkWrite updateMany with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "updateMany" - arguments: - filter: &updateMany_filter { _id: { $lt: 3 } } - update: &updateMany_update { $inc: { x: 1 } } - hint: *hint_string - - - name: "updateMany" - arguments: - filter: *updateMany_filter - update: *updateMany_update - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome - - - description: "Unacknowledged bulkWrite replaceOne with hints fails with client-side error" - operations: - - - name: "bulkWrite" - collectionOptions: *collection_options - arguments: - requests: - - - name: "replaceOne" - arguments: - filter: { _id: 3 } - replacement: { x: 333 } - hint: *hint_string - - - name: "replaceOne" - arguments: - filter: { _id: 4 } - replacement: { x: 444 } - hint: *hint_doc - options: { ordered: true } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json b/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json deleted file mode 100644 index 532f4282a98..00000000000 --- a/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "DeleteMany_hint", - "tests": [ - { - "description": "Unacknowledged deleteMany with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Unacknowledged deleteMany with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml deleted file mode 100644 index 4f08b361db4..00000000000 --- a/test/spec/crud/v2/unacknowledged-deleteMany-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - -collection_name: &collection_name 'DeleteMany_hint' - -tests: - - - description: "Unacknowledged deleteMany with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: deleteMany - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "Unacknowledged deleteMany with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: deleteMany - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json deleted file mode 100644 index ff3f05ea3ea..00000000000 --- a/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "DeleteOne_hint", - "tests": [ - { - "description": "Unacknowledged deleteOne with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged deleteOne with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml deleted file mode 100644 index 1084235dd44..00000000000 --- a/test/spec/crud/v2/unacknowledged-deleteOne-hint-clientError.yml +++ /dev/null @@ -1,38 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'DeleteOne_hint' - -tests: - - - description: "Unacknowledged deleteOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: deleteOne - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged deleteOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: deleteOne - arguments: - filter: *filter - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json deleted file mode 100644 index 076978874d2..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "findOneAndDelete_hint", - "tests": [ - { - "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml deleted file mode 100644 index fda6d85e128..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndDelete-hint-clientError.yml +++ /dev/null @@ -1,42 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'findOneAndDelete_hint' - -tests: - - - description: "Unacknowledged findOneAndDelete with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndDelete with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndDelete - arguments: - filter: &filter { _id: 1 } - hint: { _id: 1 } - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } diff --git a/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json deleted file mode 100644 index 38fbc817be5..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "FindOneAndReplace_hint", - "tests": [ - { - "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml deleted file mode 100644 index 628aef53642..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndReplace-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'FindOneAndReplace_hint' - -tests: - - - description: "Unacknowledged findOneAndReplace with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndReplace - arguments: - filter: &filter { _id: 1 } - replacement: &replacement { x: 33 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndReplace with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndReplace - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json b/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json deleted file mode 100644 index 615b4c0e63f..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "FindOneAndUpdate_hint", - "tests": [ - { - "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml deleted file mode 100644 index 3aa2ac044a4..00000000000 --- a/test/spec/crud/v2/unacknowledged-findOneAndUpdate-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - -collection_name: &collection_name 'FindOneAndUpdate_hint' - -tests: - - - description: "Unacknowledged findOneAndUpdate with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: findOneAndUpdate - arguments: - filter: &filter { _id: 1 } - update: &update { $inc: { x: 1 }} - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - - description: "Unacknowledged findOneAndUpdate with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: findOneAndUpdate - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json deleted file mode 100644 index c4add73c2de..00000000000 --- a/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "ReplaceOne_hint", - "tests": [ - { - "description": "Unacknowledged ReplaceOne with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged ReplaceOne with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml deleted file mode 100644 index 5d5cbeac1d9..00000000000 --- a/test/spec/crud/v2/unacknowledged-replaceOne-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'ReplaceOne_hint' - -tests: - - - description: "Unacknowledged ReplaceOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: replaceOne - arguments: - filter: &filter { _id: { $gt: 1 } } - replacement: &replacement { x: 111 } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "Unacknowledged ReplaceOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: replaceOne - arguments: - filter: *filter - replacement: *replacement - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json b/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json deleted file mode 100644 index eaf3efd1cf7..00000000000 --- a/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "Updatemany_hint", - "tests": [ - { - "description": "Unacknowledged updateMany with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "Unacknowledged updateMany with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml deleted file mode 100644 index aeec51b92e1..00000000000 --- a/test/spec/crud/v2/unacknowledged-updateMany-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'Updatemany_hint' - -tests: - - - description: "Unacknowledged updateMany with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - - description: "Unacknowledged updateMany with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome - diff --git a/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json b/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json deleted file mode 100644 index 1f8f738012f..00000000000 --- a/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "UpdateOne_hint", - "tests": [ - { - "description": "Unacknowledged updateOne with hint string fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "Unacknowledged updateOne with hint document fails with client-side error", - "operations": [ - { - "object": "collection", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - }, - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml b/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml deleted file mode 100644 index bdd32aea37d..00000000000 --- a/test/spec/crud/v2/unacknowledged-updateOne-hint-clientError.yml +++ /dev/null @@ -1,40 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'UpdateOne_hint' - -tests: - - - description: "Unacknowledged updateOne with hint string fails with client-side error" - operations: - - - object: collection - collectionOptions: &collection_options - writeConcern: { w: 0 } - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "Unacknowledged updateOne with hint document fails with client-side error" - operations: - - - object: collection - collectionOptions: *collection_options - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/updateMany-hint-clientError.yml b/test/spec/crud/v2/updateMany-hint-clientError.yml deleted file mode 100644 index c6a06ef5ba9..00000000000 --- a/test/spec/crud/v2/updateMany-hint-clientError.yml +++ /dev/null @@ -1,45 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateMany options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string unsupported (client-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - - description: "UpdateMany with hint document unsupported (client-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/updateMany-hint-serverError.json b/test/spec/crud/v2/updateMany-hint-serverError.json deleted file mode 100644 index 86f21246e90..00000000000 --- a/test/spec/crud/v2/updateMany-hint-serverError.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_updatemany_hint", - "tests": [ - { - "description": "UpdateMany with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - }, - { - "description": "UpdateMany with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateMany-hint-serverError.yml b/test/spec/crud/v2/updateMany-hint-serverError.yml deleted file mode 100644 index 245dbc72588..00000000000 --- a/test/spec/crud/v2/updateMany-hint-serverError.yml +++ /dev/null @@ -1,66 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateMany options, and server versions >= 4.2.0 - # support the hint option in updateMany. - - { minServerVersion: "3.4.0", maxServerVersion: "4.1.9" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string unsupported (server-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - - - description: "UpdateMany with hint document unsupported (server-side error)" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/updateMany-hint.json b/test/spec/crud/v2/updateMany-hint.json deleted file mode 100644 index 489348917f9..00000000000 --- a/test/spec/crud/v2/updateMany-hint.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "collection_name": "test_updatemany_hint", - "tests": [ - { - "description": "UpdateMany with hint string", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - } - }, - { - "description": "UpdateMany with hint document", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateMany-hint.yml b/test/spec/crud/v2/updateMany-hint.yml deleted file mode 100644 index 57067f0778f..00000000000 --- a/test/spec/crud/v2/updateMany-hint.yml +++ /dev/null @@ -1,65 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -collection_name: &collection_name 'test_updatemany_hint' - -tests: - - - description: "UpdateMany with hint string" - operations: - - - object: collection - name: updateMany - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - result: &result - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: "_id_" - outcome: &outcome - collection: - data: - - { _id: 1, x: 11 } - - { _id: 2, x: 23 } - - { _id: 3, x: 34 } - - - description: "UpdateMany with hint document" - operations: - - - object: collection - name: updateMany - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - multi: true - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/updateMany-validation.json b/test/spec/crud/v2/updateMany-validation.json deleted file mode 100644 index a85ccfa86ea..00000000000 --- a/test/spec/crud/v2/updateMany-validation.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "tests": [ - { - "description": "UpdateOne requires atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 44 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateMany-validation.yml b/test/spec/crud/v2/updateMany-validation.yml deleted file mode 100644 index 982df82625e..00000000000 --- a/test/spec/crud/v2/updateMany-validation.yml +++ /dev/null @@ -1,25 +0,0 @@ -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} - -tests: - - - description: "UpdateOne requires atomic modifiers" - operations: - - - object: collection - name: updateMany - arguments: - filter: { _id: { $gt: 1 }} - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - update: { x: 44 } - error: true - expectations: [] - outcome: - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - {_id: 3, x: 33} diff --git a/test/spec/crud/v2/updateOne-hint-clientError.json b/test/spec/crud/v2/updateOne-hint-clientError.json deleted file mode 100644 index 82bfe368c7a..00000000000 --- a/test/spec/crud/v2/updateOne-hint-clientError.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "3.3.99" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "UpdateOne with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateOne-hint-clientError.yml b/test/spec/crud/v2/updateOne-hint-clientError.yml deleted file mode 100644 index 41e42ebf2f0..00000000000 --- a/test/spec/crud/v2/updateOne-hint-clientError.yml +++ /dev/null @@ -1,43 +0,0 @@ -runOn: - # Server versions >= 3.4.0 will return an error response for unrecognized - # updateOne options. These tests check that the driver will raise an error - # if a hint is provided on a server version < 3.4. - - { maxServerVersion: "3.3.99" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string unsupported (client-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: [] - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 22 } - - - description: "UpdateOne with hint document unsupported (client-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: [] - outcome: *outcome diff --git a/test/spec/crud/v2/updateOne-hint-serverError.json b/test/spec/crud/v2/updateOne-hint-serverError.json deleted file mode 100644 index 8e8037eb8c3..00000000000 --- a/test/spec/crud/v2/updateOne-hint-serverError.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - }, - { - "description": "UpdateOne with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "error": true - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateOne-hint-serverError.yml b/test/spec/crud/v2/updateOne-hint-serverError.yml deleted file mode 100644 index 73b11519732..00000000000 --- a/test/spec/crud/v2/updateOne-hint-serverError.yml +++ /dev/null @@ -1,62 +0,0 @@ -runOn: - # These tests assert that the driver does not raise client-side errors and - # instead relies on the server to raise an error. Server versions >= 3.4.0 - # raise errors for unknown updateOne options, and server versions >= 4.2.0 - # support the hint option in updateOne. - - { minServerVersion: "3.4.0", maxServerVersion: "4.1.9" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string unsupported (server-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - - - description: "UpdateOne with hint document unsupported (server-side error)" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - error: true - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/updateOne-hint.json b/test/spec/crud/v2/updateOne-hint.json deleted file mode 100644 index 43f76da4988..00000000000 --- a/test/spec/crud/v2/updateOne-hint.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.2.0" - } - ], - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ], - "collection_name": "test_updateone_hint", - "tests": [ - { - "description": "UpdateOne with hint string", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - } - }, - { - "description": "UpdateOne with hint document", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - ] - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateOne-hint.yml b/test/spec/crud/v2/updateOne-hint.yml deleted file mode 100644 index cb86da9475d..00000000000 --- a/test/spec/crud/v2/updateOne-hint.yml +++ /dev/null @@ -1,61 +0,0 @@ -runOn: - - { minServerVersion: "4.2.0" } - -data: - - {_id: 1, x: 11} - - {_id: 2, x: 22} - -collection_name: &collection_name 'test_updateone_hint' - -tests: - - - description: "UpdateOne with hint string" - operations: - - - object: collection - name: updateOne - arguments: - filter: &filter { _id: { $gt: 1 } } - update: &update { $inc: { x: 1 } } - hint: "_id_" - result: &result - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: "_id_" - outcome: &outcome - collection: - data: - - {_id: 1, x: 11 } - - {_id: 2, x: 23 } - - - description: "UpdateOne with hint document" - operations: - - - object: collection - name: updateOne - arguments: - filter: *filter - update: *update - hint: { _id: 1 } - result: *result - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: *filter - u: *update - hint: { _id: 1 } - outcome: *outcome diff --git a/test/spec/crud/v2/updateOne-validation.json b/test/spec/crud/v2/updateOne-validation.json deleted file mode 100644 index 6c919f5ea04..00000000000 --- a/test/spec/crud/v2/updateOne-validation.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": [ - { - "_id": 1, - "x": 11 - } - ], - "tests": [ - { - "description": "UpdateOne requires atomic modifiers", - "operations": [ - { - "object": "collection", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "x": 22 - } - }, - "error": true - } - ], - "expectations": [], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 11 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateOne-validation.yml b/test/spec/crud/v2/updateOne-validation.yml deleted file mode 100644 index 290952ca507..00000000000 --- a/test/spec/crud/v2/updateOne-validation.yml +++ /dev/null @@ -1,21 +0,0 @@ -data: - - { _id: 1, x: 11 } - -tests: - - - description: "UpdateOne requires atomic modifiers" - operations: - - - object: collection - name: updateOne - arguments: - filter: { _id: 1 } - # Only the first field is tested, as the spec permits drivers to only - # check that and rely on the server to check subsequent fields. - update: { x: 22 } - error: true - expectations: [] - outcome: - collection: - data: - - { _id: 1, x: 11 } diff --git a/test/spec/crud/v2/updateWithPipelines.json b/test/spec/crud/v2/updateWithPipelines.json deleted file mode 100644 index a310f2825f2..00000000000 --- a/test/spec/crud/v2/updateWithPipelines.json +++ /dev/null @@ -1,408 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.11" - } - ], - "data": [ - { - "_id": 1, - "x": 1, - "y": 1, - "t": { - "u": { - "v": 1 - } - } - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ], - "collection_name": "test", - "database_name": "crud-tests", - "tests": [ - { - "description": "UpdateOne using pipelines", - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateMany using pipelines", - "operations": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - } - }, - { - "description": "FindOneAndUpdate using pipelines", - "operations": [ - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "findAndModify": "test", - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "command_name": "findAndModify", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateOne in bulk write using pipelines", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - } - }, - { - "description": "UpdateMany in bulk write using pipelines", - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "updateMany", - "arguments": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true - } - ] - }, - "command_name": "update", - "database_name": "crud-tests" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - } - } - ] -} diff --git a/test/spec/crud/v2/updateWithPipelines.yml b/test/spec/crud/v2/updateWithPipelines.yml deleted file mode 100644 index 08eef7b0b33..00000000000 --- a/test/spec/crud/v2/updateWithPipelines.yml +++ /dev/null @@ -1,157 +0,0 @@ -runOn: - - - minServerVersion: "4.1.11" - -data: - - { _id: 1, x: 1, y: 1, t: {u: {v: 1}} } - - { _id: 2, x: 2, y: 1 } - -collection_name: &collection_name "test" -database_name: &database_name "crud-tests" - -tests: - - - description: "UpdateOne using pipelines" - operations: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - update: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 1 } - u: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, u: {v: 1}, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateMany using pipelines" - operations: - - - name: "updateMany" - arguments: - filter: {} - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { } - u: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - multi: true - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, foo: 1 } - - - description: "FindOneAndUpdate using pipelines" - operations: - - - name: "findOneAndUpdate" - arguments: - filter: { _id: 1 } - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - expectations: - - - command_started_event: - command: - findAndModify: *collection_name - update: - - $project: { x: 1 } - - $addFields: { foo: 1 } - command_name: findAndModify - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateOne in bulk write using pipelines" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateOne" - arguments: - filter: { _id: 1 } - update: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 1 - modifiedCount: 1 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { _id: 1 } - u: [ { $replaceRoot: { newRoot: "$t" } }, { $addFields: { foo: 1 } } ] - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, u: {v: 1}, foo: 1 } - - { _id: 2, x: 2, y: 1 } - - - description: "UpdateMany in bulk write using pipelines" - operations: - - - name: "bulkWrite" - arguments: - requests: - - - name: "updateMany" - arguments: - filter: {} - update: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - result: - matchedCount: 2 - modifiedCount: 2 - upsertedCount: 0 - expectations: - - - command_started_event: - command: - update: *collection_name - updates: - - - q: { } - u: [ { $project: { x: 1 } }, { $addFields: { foo: 1 } } ] - multi: true - command_name: update - database_name: *database_name - outcome: - collection: - data: - - { _id: 1, x: 1, foo: 1 } - - { _id: 2, x: 2, foo: 1 } diff --git a/test/spec/retryable-reads/aggregate-serverErrors.json b/test/spec/retryable-reads/aggregate-serverErrors.json index 67636d5b7dc..1155f808dcc 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.json +++ b/test/spec/retryable-reads/aggregate-serverErrors.json @@ -219,7 +219,7 @@ ] }, { - "description": "Aggregate succeeds after NotMaster", + "description": "Aggregate succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -312,7 +312,7 @@ ] }, { - "description": "Aggregate succeeds after NotMasterNoSlaveOk", + "description": "Aggregate succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -405,7 +405,7 @@ ] }, { - "description": "Aggregate succeeds after NotMasterOrSecondary", + "description": "Aggregate succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -1056,7 +1056,7 @@ ] }, { - "description": "Aggregate fails after two NotMaster errors", + "description": "Aggregate fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -1140,7 +1140,7 @@ ] }, { - "description": "Aggregate fails after NotMaster when retryReads is false", + "description": "Aggregate fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/aggregate-serverErrors.yml b/test/spec/retryable-reads/aggregate-serverErrors.yml index b64b7b3adc4..bf9fc018925 100644 --- a/test/spec/retryable-reads/aggregate-serverErrors.yml +++ b/test/spec/retryable-reads/aggregate-serverErrors.yml @@ -52,7 +52,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMaster" + description: "Aggregate succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -61,7 +61,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMasterNoSlaveOk" + description: "Aggregate succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -70,7 +70,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate succeeds after NotMasterOrSecondary" + description: "Aggregate succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate fails after two NotMaster errors" + description: "Aggregate fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -146,7 +146,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Aggregate fails after NotMaster when retryReads is false" + description: "Aggregate fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/aggregate.yml b/test/spec/retryable-reads/aggregate.yml index c8443e3fbf3..de9c0d7069a 100644 --- a/test/spec/retryable-reads/aggregate.yml +++ b/test/spec/retryable-reads/aggregate.yml @@ -84,4 +84,4 @@ tests: aggregate: *collection_name pipeline: [{$match: {_id: {$gt: 1}}}, {$sort: {x: 1}}, {$out: 'output-collection'}] command_name: aggregate - database_name: *database_name \ No newline at end of file + database_name: *database_name diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json index 17bc53fd4bd..73dbfee916f 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -142,7 +143,7 @@ ] }, { - "description": "client.watch succeeds after NotMaster", + "description": "client.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -197,7 +198,7 @@ ] }, { - "description": "client.watch succeeds after NotMasterNoSlaveOk", + "description": "client.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -252,7 +253,7 @@ ] }, { - "description": "client.watch succeeds after NotMasterOrSecondary", + "description": "client.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -637,7 +638,7 @@ ] }, { - "description": "client.watch fails after two NotMaster errors", + "description": "client.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -693,7 +694,7 @@ ] }, { - "description": "client.watch fails after NotMaster when retryReads is false", + "description": "client.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml index 61fe2358a1c..a1f10696435 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMaster" + description: "client.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMasterNoSlaveOk" + description: "client.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch succeeds after NotMasterOrSecondary" + description: "client.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch fails after two NotMaster errors" + description: "client.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "client.watch fails after NotMaster when retryReads is false" + description: "client.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-client.watch.json b/test/spec/retryable-reads/changeStreams-client.watch.json index 9a07053f843..30a53037ad2 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.json +++ b/test/spec/retryable-reads/changeStreams-client.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-client.watch.yml b/test/spec/retryable-reads/changeStreams-client.watch.yml index 5550bfa100e..ea7f7e069a3 100644 --- a/test/spec/retryable-reads/changeStreams-client.watch.yml +++ b/test/spec/retryable-reads/changeStreams-client.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json index 5b405e3feba..77b3af04f45 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -134,7 +135,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMaster", + "description": "db.coll.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -185,7 +186,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMasterNoSlaveOk", + "description": "db.coll.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +237,7 @@ ] }, { - "description": "db.coll.watch succeeds after NotMasterOrSecondary", + "description": "db.coll.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -593,7 +594,7 @@ ] }, { - "description": "db.coll.watch fails after two NotMaster errors", + "description": "db.coll.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -645,7 +646,7 @@ ] }, { - "description": "db.coll.watch fails after NotMaster when retryReads is false", + "description": "db.coll.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml index 37ad0ae00d0..4e4bb4a1b7f 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMaster" + description: "db.coll.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMasterNoSlaveOk" + description: "db.coll.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch succeeds after NotMasterOrSecondary" + description: "db.coll.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch fails after two NotMaster errors" + description: "db.coll.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.coll.watch fails after NotMaster when retryReads is false" + description: "db.coll.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.json b/test/spec/retryable-reads/changeStreams-db.coll.watch.json index 5e69d9da260..27f6105a4bb 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml index 50258cca2ec..c8334b1a993 100644 --- a/test/spec/retryable-reads/changeStreams-db.coll.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.coll.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json index 56fa6629010..7a875345080 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", @@ -134,7 +135,7 @@ ] }, { - "description": "db.watch succeeds after NotMaster", + "description": "db.watch succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -185,7 +186,7 @@ ] }, { - "description": "db.watch succeeds after NotMasterNoSlaveOk", + "description": "db.watch succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +237,7 @@ ] }, { - "description": "db.watch succeeds after NotMasterOrSecondary", + "description": "db.watch succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -593,7 +594,7 @@ ] }, { - "description": "db.watch fails after two NotMaster errors", + "description": "db.watch fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -645,7 +646,7 @@ ] }, { - "description": "db.watch fails after NotMaster when retryReads is false", + "description": "db.watch fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml index 7ee9df0743b..a527935bae2 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch-serverErrors.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" @@ -44,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMaster" + description: "db.watch succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -53,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMasterNoSlaveOk" + description: "db.watch succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -62,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch succeeds after NotMasterOrSecondary" + description: "db.watch succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -125,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch fails after two NotMaster errors" + description: "db.watch fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "db.watch fails after NotMaster when retryReads is false" + description: "db.watch fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/changeStreams-db.watch.json b/test/spec/retryable-reads/changeStreams-db.watch.json index 1777e1832e0..e6b0b9b781e 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.json +++ b/test/spec/retryable-reads/changeStreams-db.watch.json @@ -11,7 +11,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/changeStreams-db.watch.yml b/test/spec/retryable-reads/changeStreams-db.watch.yml index e46c5141690..e2ceacbb666 100644 --- a/test/spec/retryable-reads/changeStreams-db.watch.yml +++ b/test/spec/retryable-reads/changeStreams-db.watch.yml @@ -5,6 +5,7 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/retryable-reads/count-serverErrors.json b/test/spec/retryable-reads/count-serverErrors.json index 565323640e4..36a0c17cab0 100644 --- a/test/spec/retryable-reads/count-serverErrors.json +++ b/test/spec/retryable-reads/count-serverErrors.json @@ -115,7 +115,7 @@ ] }, { - "description": "Count succeeds after NotMaster", + "description": "Count succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -158,7 +158,7 @@ ] }, { - "description": "Count succeeds after NotMasterNoSlaveOk", + "description": "Count succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -201,7 +201,7 @@ ] }, { - "description": "Count succeeds after NotMasterOrSecondary", + "description": "Count succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -502,7 +502,7 @@ ] }, { - "description": "Count fails after two NotMaster errors", + "description": "Count fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -545,7 +545,7 @@ ] }, { - "description": "Count fails after NotMaster when retryReads is false", + "description": "Count fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/count-serverErrors.yml b/test/spec/retryable-reads/count-serverErrors.yml index 4f7f5c9c940..48ceaea68b8 100644 --- a/test/spec/retryable-reads/count-serverErrors.yml +++ b/test/spec/retryable-reads/count-serverErrors.yml @@ -44,7 +44,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMaster" + description: "Count succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 10107 } @@ -53,7 +53,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMasterNoSlaveOk" + description: "Count succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13435 } @@ -62,7 +62,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count succeeds after NotMasterOrSecondary" + description: "Count succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13436 } @@ -125,7 +125,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count fails after two NotMaster errors" + description: "Count fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -138,7 +138,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Count fails after NotMaster when retryReads is false" + description: "Count fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.json b/test/spec/retryable-reads/countDocuments-serverErrors.json index 107372ef30a..782ea5e4f18 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.json +++ b/test/spec/retryable-reads/countDocuments-serverErrors.json @@ -167,7 +167,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMaster", + "description": "CountDocuments succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -236,7 +236,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMasterNoSlaveOk", + "description": "CountDocuments succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -305,7 +305,7 @@ ] }, { - "description": "CountDocuments succeeds after NotMasterOrSecondary", + "description": "CountDocuments succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -788,7 +788,7 @@ ] }, { - "description": "CountDocuments fails after two NotMaster errors", + "description": "CountDocuments fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -857,7 +857,7 @@ ] }, { - "description": "CountDocuments fails after NotMaster when retryReads is false", + "description": "CountDocuments fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/countDocuments-serverErrors.yml b/test/spec/retryable-reads/countDocuments-serverErrors.yml index 6d5e309cf98..4ffb9a05b5c 100644 --- a/test/spec/retryable-reads/countDocuments-serverErrors.yml +++ b/test/spec/retryable-reads/countDocuments-serverErrors.yml @@ -45,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMaster" + description: "CountDocuments succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMasterNoSlaveOk" + description: "CountDocuments succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments succeeds after NotMasterOrSecondary" + description: "CountDocuments succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -126,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments fails after two NotMaster errors" + description: "CountDocuments fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -139,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "CountDocuments fails after NotMaster when retryReads is false" + description: "CountDocuments fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/distinct-serverErrors.json b/test/spec/retryable-reads/distinct-serverErrors.json index 109231c6702..d7c6018a624 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.json +++ b/test/spec/retryable-reads/distinct-serverErrors.json @@ -159,7 +159,7 @@ ] }, { - "description": "Distinct succeeds after NotMaster", + "description": "Distinct succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -222,7 +222,7 @@ ] }, { - "description": "Distinct succeeds after NotMasterNoSlaveOk", + "description": "Distinct succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -285,7 +285,7 @@ ] }, { - "description": "Distinct succeeds after NotMasterOrSecondary", + "description": "Distinct succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -726,7 +726,7 @@ ] }, { - "description": "Distinct fails after two NotMaster errors", + "description": "Distinct fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -786,7 +786,7 @@ ] }, { - "description": "Distinct fails after NotMaster when retryReads is false", + "description": "Distinct fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/distinct-serverErrors.yml b/test/spec/retryable-reads/distinct-serverErrors.yml index 3de14aeb08e..d4bc118ff6b 100644 --- a/test/spec/retryable-reads/distinct-serverErrors.yml +++ b/test/spec/retryable-reads/distinct-serverErrors.yml @@ -50,7 +50,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMaster" + description: "Distinct succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 10107 } @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMasterNoSlaveOk" + description: "Distinct succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 13435 } @@ -68,7 +68,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct succeeds after NotMasterOrSecondary" + description: "Distinct succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [distinct], errorCode: 13436 } @@ -131,7 +131,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct fails after two NotMaster errors" + description: "Distinct fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -144,7 +144,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Distinct fails after NotMaster when retryReads is false" + description: "Distinct fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json index af4dc52ea8e..756b02b3a85 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.json @@ -158,7 +158,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMaster", + "description": "EstimatedDocumentCount succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -228,7 +228,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk", + "description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -298,7 +298,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterOrSecondary", + "description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -788,7 +788,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after two NotMaster errors", + "description": "EstimatedDocumentCount fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -858,7 +858,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after NotMaster when retryReads is false", + "description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml index f08e740da23..1a73d54312b 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-4.9.yml @@ -41,7 +41,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMaster" + description: "EstimatedDocumentCount succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 10107 } @@ -50,7 +50,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk" + description: "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13435 } @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterOrSecondary" + description: "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [aggregate], errorCode: 13436 } @@ -122,7 +122,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after two NotMaster errors" + description: "EstimatedDocumentCount fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -135,7 +135,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after NotMaster when retryReads is false" + description: "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json index c11e609cd4e..0b9a2615d1e 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.json @@ -110,7 +110,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMaster", + "description": "EstimatedDocumentCount succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -150,7 +150,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk", + "description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -190,7 +190,7 @@ ] }, { - "description": "EstimatedDocumentCount succeeds after NotMasterOrSecondary", + "description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -470,7 +470,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after two NotMaster errors", + "description": "EstimatedDocumentCount fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -510,7 +510,7 @@ ] }, { - "description": "EstimatedDocumentCount fails after NotMaster when retryReads is false", + "description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml index 0f0dcc656b3..99c343b8895 100644 --- a/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml +++ b/test/spec/retryable-reads/estimatedDocumentCount-serverErrors-pre4.9.yml @@ -45,7 +45,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMaster" + description: "EstimatedDocumentCount succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 10107 } @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterNoSlaveOk" + description: "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13435 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount succeeds after NotMasterOrSecondary" + description: "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [count], errorCode: 13436 } @@ -126,7 +126,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after two NotMaster errors" + description: "EstimatedDocumentCount fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -139,7 +139,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "EstimatedDocumentCount fails after NotMaster when retryReads is false" + description: "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/find-serverErrors.json b/test/spec/retryable-reads/find-serverErrors.json index 914b91da05a..f6b96c6dcb3 100644 --- a/test/spec/retryable-reads/find-serverErrors.json +++ b/test/spec/retryable-reads/find-serverErrors.json @@ -189,7 +189,7 @@ ] }, { - "description": "Find succeeds after NotMaster", + "description": "Find succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -263,7 +263,7 @@ ] }, { - "description": "Find succeeds after NotMasterNoSlaveOk", + "description": "Find succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -337,7 +337,7 @@ ] }, { - "description": "Find succeeds after NotMasterOrSecondary", + "description": "Find succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -855,7 +855,7 @@ ] }, { - "description": "Find fails after two NotMaster errors", + "description": "Find fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -912,7 +912,7 @@ ] }, { - "description": "Find fails after NotMaster when retryReads is false", + "description": "Find fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/find-serverErrors.yml b/test/spec/retryable-reads/find-serverErrors.yml index 17819ea8620..e122f3e2c84 100644 --- a/test/spec/retryable-reads/find-serverErrors.yml +++ b/test/spec/retryable-reads/find-serverErrors.yml @@ -54,7 +54,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMaster" + description: "Find succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -63,7 +63,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMasterNoSlaveOk" + description: "Find succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -72,7 +72,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find succeeds after NotMasterOrSecondary" + description: "Find succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -135,7 +135,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find fails after two NotMaster errors" + description: "Find fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -148,7 +148,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Find fails after NotMaster when retryReads is false" + description: "Find fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/findOne-serverErrors.json b/test/spec/retryable-reads/findOne-serverErrors.json index 4c0c07234ed..d039ef247e0 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.json +++ b/test/spec/retryable-reads/findOne-serverErrors.json @@ -149,7 +149,7 @@ ] }, { - "description": "FindOne succeeds after NotMaster", + "description": "FindOne succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -203,7 +203,7 @@ ] }, { - "description": "FindOne succeeds after NotMasterNoSlaveOk", + "description": "FindOne succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -257,7 +257,7 @@ ] }, { - "description": "FindOne succeeds after NotMasterOrSecondary", + "description": "FindOne succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -635,7 +635,7 @@ ] }, { - "description": "FindOne fails after two NotMaster errors", + "description": "FindOne fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -686,7 +686,7 @@ ] }, { - "description": "FindOne fails after NotMaster when retryReads is false", + "description": "FindOne fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/findOne-serverErrors.yml b/test/spec/retryable-reads/findOne-serverErrors.yml index 63ced439c98..b6e76574086 100644 --- a/test/spec/retryable-reads/findOne-serverErrors.yml +++ b/test/spec/retryable-reads/findOne-serverErrors.yml @@ -49,7 +49,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMaster" + description: "FindOne succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -58,7 +58,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMasterNoSlaveOk" + description: "FindOne succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -67,7 +67,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne succeeds after NotMasterOrSecondary" + description: "FindOne succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -130,7 +130,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne fails after two NotMaster errors" + description: "FindOne fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -143,7 +143,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "FindOne fails after NotMaster when retryReads is false" + description: "FindOne fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.json b/test/spec/retryable-reads/gridfs-download-serverErrors.json index d54928b1268..cec3a5016a4 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.json @@ -192,7 +192,7 @@ ] }, { - "description": "Download succeeds after NotMaster", + "description": "Download succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -262,7 +262,7 @@ ] }, { - "description": "Download succeeds after NotMasterNoSlaveOk", + "description": "Download succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -332,7 +332,7 @@ ] }, { - "description": "Download succeeds after NotMasterOrSecondary", + "description": "Download succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -822,7 +822,7 @@ ] }, { - "description": "Download fails after two NotMaster errors", + "description": "Download fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -877,7 +877,7 @@ ] }, { - "description": "Download fails after NotMaster when retryReads is false", + "description": "Download fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/gridfs-download-serverErrors.yml b/test/spec/retryable-reads/gridfs-download-serverErrors.yml index aa949a5632f..e120c162fdd 100644 --- a/test/spec/retryable-reads/gridfs-download-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-download-serverErrors.yml @@ -59,7 +59,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMaster" + description: "Download succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -69,7 +69,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMasterNoSlaveOk" + description: "Download succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -79,7 +79,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download succeeds after NotMasterOrSecondary" + description: "Download succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -149,7 +149,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "Download fails after two NotMaster errors" + description: "Download fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -162,7 +162,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "Download fails after NotMaster when retryReads is false" + description: "Download fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json index 1325ab89abb..a64230d38ab 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.json @@ -180,7 +180,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMaster", + "description": "DownloadByName succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -244,7 +244,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMasterNoSlaveOk", + "description": "DownloadByName succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -308,7 +308,7 @@ ] }, { - "description": "DownloadByName succeeds after NotMasterOrSecondary", + "description": "DownloadByName succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -756,7 +756,7 @@ ] }, { - "description": "DownloadByName fails after two NotMaster errors", + "description": "DownloadByName fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -805,7 +805,7 @@ ] }, { - "description": "DownloadByName fails after NotMaster when retryReads is false", + "description": "DownloadByName fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml index a66ba9b1402..704492135e8 100644 --- a/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml +++ b/test/spec/retryable-reads/gridfs-downloadByName-serverErrors.yml @@ -60,7 +60,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMaster" + description: "DownloadByName succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 10107 } @@ -70,7 +70,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMasterNoSlaveOk" + description: "DownloadByName succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13435 } @@ -80,7 +80,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName succeeds after NotMasterOrSecondary" + description: "DownloadByName succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [find], errorCode: 13436 } @@ -150,7 +150,7 @@ tests: - *retryable_command_started_event - *find_chunks_command_started_event - - description: "DownloadByName fails after two NotMaster errors" + description: "DownloadByName fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -163,7 +163,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "DownloadByName fails after NotMaster when retryReads is false" + description: "DownloadByName fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: @@ -171,4 +171,4 @@ tests: data: { failCommands: [find], errorCode: 10107 } operations: [*retryable_operation_fails] expectations: - - *retryable_command_started_event \ No newline at end of file + - *retryable_command_started_event diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.json b/test/spec/retryable-reads/listCollectionNames-serverErrors.json index 90ccda71399..bbdce625ada 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMaster", + "description": "ListCollectionNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMasterNoSlaveOk", + "description": "ListCollectionNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollectionNames succeeds after NotMasterOrSecondary", + "description": "ListCollectionNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollectionNames fails after two NotMaster errors", + "description": "ListCollectionNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollectionNames fails after NotMaster when retryReads is false", + "description": "ListCollectionNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml index 889d2a5b5ce..b99bddf827c 100644 --- a/test/spec/retryable-reads/listCollectionNames-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionNames-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMaster" + description: "ListCollectionNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMasterNoSlaveOk" + description: "ListCollectionNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames succeeds after NotMasterOrSecondary" + description: "ListCollectionNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames fails after two NotMaster errors" + description: "ListCollectionNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionNames fails after NotMaster when retryReads is false" + description: "ListCollectionNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json index 6ca8c242fab..ab469dfe30b 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.json +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMaster", + "description": "ListCollectionObjects succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMasterNoSlaveOk", + "description": "ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollectionObjects succeeds after NotMasterOrSecondary", + "description": "ListCollectionObjects succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollectionObjects fails after two NotMaster errors", + "description": "ListCollectionObjects fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollectionObjects fails after NotMaster when retryReads is false", + "description": "ListCollectionObjects fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml index 97fb0778e4e..b2ff9ee830c 100644 --- a/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listCollectionObjects-serverErrors.yml @@ -1,3 +1,7 @@ +# listCollectionObjects returns an array of MongoCollection objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst#returning-a-list-of-collection-objects + runOn: - minServerVersion: "4.0" @@ -38,7 +42,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMaster" + description: "ListCollectionObjects succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +51,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMasterNoSlaveOk" + description: "ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +60,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects succeeds after NotMasterOrSecondary" + description: "ListCollectionObjects succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +123,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects fails after two NotMaster errors" + description: "ListCollectionObjects fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +136,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollectionObjects fails after NotMaster when retryReads is false" + description: "ListCollectionObjects fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listCollectionObjects.yml b/test/spec/retryable-reads/listCollectionObjects.yml index 885c0489afe..4315694850f 100644 --- a/test/spec/retryable-reads/listCollectionObjects.yml +++ b/test/spec/retryable-reads/listCollectionObjects.yml @@ -1,3 +1,7 @@ +# listCollectionObjects returns an array of MongoCollection objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst#returning-a-list-of-collection-objects + runOn: - minServerVersion: "4.0" diff --git a/test/spec/retryable-reads/listCollections-serverErrors.json b/test/spec/retryable-reads/listCollections-serverErrors.json index 1938fa4ab4b..def9ac4595c 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.json +++ b/test/spec/retryable-reads/listCollections-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListCollections succeeds after NotMaster", + "description": "ListCollections succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListCollections succeeds after NotMasterNoSlaveOk", + "description": "ListCollections succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListCollections succeeds after NotMasterOrSecondary", + "description": "ListCollections succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListCollections fails after two NotMaster errors", + "description": "ListCollections fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListCollections fails after NotMaster when retryReads is false", + "description": "ListCollections fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listCollections-serverErrors.yml b/test/spec/retryable-reads/listCollections-serverErrors.yml index bb35d8dbc71..94a9495e523 100644 --- a/test/spec/retryable-reads/listCollections-serverErrors.yml +++ b/test/spec/retryable-reads/listCollections-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMaster" + description: "ListCollections succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMasterNoSlaveOk" + description: "ListCollections succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections succeeds after NotMasterOrSecondary" + description: "ListCollections succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listCollections], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections fails after two NotMaster errors" + description: "ListCollections fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListCollections fails after NotMaster when retryReads is false" + description: "ListCollections fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json index eef8b7fe750..1dd8e4415aa 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMaster", + "description": "ListDatabaseNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMasterNoSlaveOk", + "description": "ListDatabaseNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabaseNames succeeds after NotMasterOrSecondary", + "description": "ListDatabaseNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabaseNames fails after two NotMaster errors", + "description": "ListDatabaseNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabaseNames fails after NotMaster when retryReads is false", + "description": "ListDatabaseNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml index ef777f01757..ca6b1509448 100644 --- a/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseNames-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMaster" + description: "ListDatabaseNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMasterNoSlaveOk" + description: "ListDatabaseNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames succeeds after NotMasterOrSecondary" + description: "ListDatabaseNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames fails after two NotMaster errors" + description: "ListDatabaseNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseNames fails after NotMaster when retryReads is false" + description: "ListDatabaseNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json index 054d1dc8b18..bc497bb088c 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMaster", + "description": "ListDatabaseObjects succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMasterNoSlaveOk", + "description": "ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabaseObjects succeeds after NotMasterOrSecondary", + "description": "ListDatabaseObjects succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabaseObjects fails after two NotMaster errors", + "description": "ListDatabaseObjects fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabaseObjects fails after NotMaster when retryReads is false", + "description": "ListDatabaseObjects fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml index f413304d31f..adc8214a3b8 100644 --- a/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabaseObjects-serverErrors.yml @@ -1,3 +1,7 @@ +# listDatabaseObjects returns an array of MongoDatabase objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-databases.rst#enumerating-mongodatabase-objects + runOn: - minServerVersion: "4.0" @@ -38,7 +42,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMaster" + description: "ListDatabaseObjects succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +51,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMasterNoSlaveOk" + description: "ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +60,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects succeeds after NotMasterOrSecondary" + description: "ListDatabaseObjects succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +123,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects fails after two NotMaster errors" + description: "ListDatabaseObjects fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +136,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabaseObjects fails after NotMaster when retryReads is false" + description: "ListDatabaseObjects fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listDatabaseObjects.yml b/test/spec/retryable-reads/listDatabaseObjects.yml index e4a31cfe213..9ed2c216a5d 100644 --- a/test/spec/retryable-reads/listDatabaseObjects.yml +++ b/test/spec/retryable-reads/listDatabaseObjects.yml @@ -1,3 +1,7 @@ +# listDatabaseObjects returns an array of MongoDatabase objects. +# Not all drivers support this functionality. For more details, see: +# https://github.com/mongodb/specifications/blob/master/source/enumerate-databases.rst#enumerating-mongodatabase-objects + runOn: - minServerVersion: "4.0" diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.json b/test/spec/retryable-reads/listDatabases-serverErrors.json index 9da07b7f50b..ed7bcbc3989 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.json +++ b/test/spec/retryable-reads/listDatabases-serverErrors.json @@ -94,7 +94,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMaster", + "description": "ListDatabases succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -131,7 +131,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMasterNoSlaveOk", + "description": "ListDatabases succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -168,7 +168,7 @@ ] }, { - "description": "ListDatabases succeeds after NotMasterOrSecondary", + "description": "ListDatabases succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -427,7 +427,7 @@ ] }, { - "description": "ListDatabases fails after two NotMaster errors", + "description": "ListDatabases fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -465,7 +465,7 @@ ] }, { - "description": "ListDatabases fails after NotMaster when retryReads is false", + "description": "ListDatabases fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listDatabases-serverErrors.yml b/test/spec/retryable-reads/listDatabases-serverErrors.yml index a5ed406c847..ac904701de6 100644 --- a/test/spec/retryable-reads/listDatabases-serverErrors.yml +++ b/test/spec/retryable-reads/listDatabases-serverErrors.yml @@ -38,7 +38,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMaster" + description: "ListDatabases succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 10107 } @@ -47,7 +47,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMasterNoSlaveOk" + description: "ListDatabases succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13435 } @@ -56,7 +56,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases succeeds after NotMasterOrSecondary" + description: "ListDatabases succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listDatabases], errorCode: 13436 } @@ -119,7 +119,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases fails after two NotMaster errors" + description: "ListDatabases fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -132,7 +132,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListDatabases fails after NotMaster when retryReads is false" + description: "ListDatabases fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.json b/test/spec/retryable-reads/listIndexNames-serverErrors.json index 3737e0059e1..2d3265ec85d 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.json +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.json @@ -98,7 +98,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMaster", + "description": "ListIndexNames succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -137,7 +137,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMasterNoSlaveOk", + "description": "ListIndexNames succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -176,7 +176,7 @@ ] }, { - "description": "ListIndexNames succeeds after NotMasterOrSecondary", + "description": "ListIndexNames succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -449,7 +449,7 @@ ] }, { - "description": "ListIndexNames fails after two NotMaster errors", + "description": "ListIndexNames fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -489,7 +489,7 @@ ] }, { - "description": "ListIndexNames fails after NotMaster when retryReads is false", + "description": "ListIndexNames fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listIndexNames-serverErrors.yml b/test/spec/retryable-reads/listIndexNames-serverErrors.yml index 5420d01aa73..6fb7e30cbf3 100644 --- a/test/spec/retryable-reads/listIndexNames-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexNames-serverErrors.yml @@ -39,7 +39,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMaster" + description: "ListIndexNames succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 10107 } @@ -48,7 +48,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMasterNoSlaveOk" + description: "ListIndexNames succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13435 } @@ -57,7 +57,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames succeeds after NotMasterOrSecondary" + description: "ListIndexNames succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13436 } @@ -120,7 +120,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames fails after two NotMaster errors" + description: "ListIndexNames fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexNames fails after NotMaster when retryReads is false" + description: "ListIndexNames fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.json b/test/spec/retryable-reads/listIndexes-serverErrors.json index 6ac0b0a3f99..25c5b0e4483 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.json +++ b/test/spec/retryable-reads/listIndexes-serverErrors.json @@ -98,7 +98,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMaster", + "description": "ListIndexes succeeds after NotWritablePrimary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -137,7 +137,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMasterNoSlaveOk", + "description": "ListIndexes succeeds after NotPrimaryNoSecondaryOk", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -176,7 +176,7 @@ ] }, { - "description": "ListIndexes succeeds after NotMasterOrSecondary", + "description": "ListIndexes succeeds after NotPrimaryOrSecondary", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -449,7 +449,7 @@ ] }, { - "description": "ListIndexes fails after two NotMaster errors", + "description": "ListIndexes fails after two NotWritablePrimary errors", "failPoint": { "configureFailPoint": "failCommand", "mode": { @@ -489,7 +489,7 @@ ] }, { - "description": "ListIndexes fails after NotMaster when retryReads is false", + "description": "ListIndexes fails after NotWritablePrimary when retryReads is false", "clientOptions": { "retryReads": false }, diff --git a/test/spec/retryable-reads/listIndexes-serverErrors.yml b/test/spec/retryable-reads/listIndexes-serverErrors.yml index 7e203ae1d5c..23f2768e9ac 100644 --- a/test/spec/retryable-reads/listIndexes-serverErrors.yml +++ b/test/spec/retryable-reads/listIndexes-serverErrors.yml @@ -39,7 +39,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMaster" + description: "ListIndexes succeeds after NotWritablePrimary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 10107 } @@ -48,7 +48,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMasterNoSlaveOk" + description: "ListIndexes succeeds after NotPrimaryNoSecondaryOk" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13435 } @@ -57,7 +57,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes succeeds after NotMasterOrSecondary" + description: "ListIndexes succeeds after NotPrimaryOrSecondary" failPoint: <<: *failCommand_failPoint data: { failCommands: [listIndexes], errorCode: 13436 } @@ -120,7 +120,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes fails after two NotMaster errors" + description: "ListIndexes fails after two NotWritablePrimary errors" failPoint: <<: *failCommand_failPoint mode: { times: 2 } @@ -133,7 +133,7 @@ tests: - *retryable_command_started_event - *retryable_command_started_event - - description: "ListIndexes fails after NotMaster when retryReads is false" + description: "ListIndexes fails after NotWritablePrimary when retryReads is false" clientOptions: retryReads: false failPoint: diff --git a/test/spec/retryable-reads/mapReduce.json b/test/spec/retryable-reads/mapReduce.json index e76aa76cbb9..9327a23052b 100644 --- a/test/spec/retryable-reads/mapReduce.json +++ b/test/spec/retryable-reads/mapReduce.json @@ -12,7 +12,8 @@ "topology": [ "sharded", "load-balanced" - ] + ], + "serverless": "forbid" } ], "database_name": "retryable-reads-tests", diff --git a/test/spec/retryable-reads/mapReduce.yml b/test/spec/retryable-reads/mapReduce.yml index 968d3d50371..def8b37485d 100644 --- a/test/spec/retryable-reads/mapReduce.yml +++ b/test/spec/retryable-reads/mapReduce.yml @@ -5,6 +5,8 @@ runOn: - minServerVersion: "4.1.7" topology: ["sharded", "load-balanced"] + # serverless proxy does not support mapReduce operation + serverless: "forbid" database_name: &database_name "retryable-reads-tests" collection_name: &collection_name "coll" diff --git a/test/spec/transactions/legacy/error-labels.json b/test/spec/transactions/legacy/error-labels.json index 2d3eed3ccc3..f23be6ac92b 100644 --- a/test/spec/transactions/legacy/error-labels.json +++ b/test/spec/transactions/legacy/error-labels.json @@ -10,7 +10,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/error-labels.yml b/test/spec/transactions/legacy/error-labels.yml index 3fc36c8f0c4..f0cfebf1729 100644 --- a/test/spec/transactions/legacy/error-labels.yml +++ b/test/spec/transactions/legacy/error-labels.yml @@ -5,6 +5,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-pin-auto-tests.py b/test/spec/transactions/legacy/mongos-pin-auto-tests.py index b035c436899..1072ec29073 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto-tests.py +++ b/test/spec/transactions/legacy/mongos-pin-auto-tests.py @@ -17,6 +17,9 @@ - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-pin-auto.json b/test/spec/transactions/legacy/mongos-pin-auto.json index f6ede52687c..037f212f490 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto.json +++ b/test/spec/transactions/legacy/mongos-pin-auto.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/mongos-pin-auto.yml b/test/spec/transactions/legacy/mongos-pin-auto.yml index f2b84ac8de0..7e2e3e4453b 100644 --- a/test/spec/transactions/legacy/mongos-pin-auto.yml +++ b/test/spec/transactions/legacy/mongos-pin-auto.yml @@ -4,6 +4,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/mongos-recovery-token.json b/test/spec/transactions/legacy/mongos-recovery-token.json index 35ef45a0394..3294628f20b 100644 --- a/test/spec/transactions/legacy/mongos-recovery-token.json +++ b/test/spec/transactions/legacy/mongos-recovery-token.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/mongos-recovery-token.yml b/test/spec/transactions/legacy/mongos-recovery-token.yml index 94f32b1d348..28334be177a 100644 --- a/test/spec/transactions/legacy/mongos-recovery-token.yml +++ b/test/spec/transactions/legacy/mongos-recovery-token.yml @@ -2,6 +2,8 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't use recovery tokens + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/legacy/pin-mongos.json b/test/spec/transactions/legacy/pin-mongos.json index 8e9d049d048..d0897558699 100644 --- a/test/spec/transactions/legacy/pin-mongos.json +++ b/test/spec/transactions/legacy/pin-mongos.json @@ -4,7 +4,8 @@ "minServerVersion": "4.1.8", "topology": [ "sharded" - ] + ], + "serverless": "forbid" } ], "database_name": "transaction-tests", diff --git a/test/spec/transactions/legacy/pin-mongos.yml b/test/spec/transactions/legacy/pin-mongos.yml index b611e5003a2..c1e40d42f7f 100644 --- a/test/spec/transactions/legacy/pin-mongos.yml +++ b/test/spec/transactions/legacy/pin-mongos.yml @@ -16,6 +16,9 @@ runOn: - minServerVersion: "4.1.8" topology: ["sharded"] + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + serverless: "forbid" database_name: &database_name "transaction-tests" collection_name: &collection_name "test" diff --git a/test/spec/transactions/unified/mongos-unpin.json b/test/spec/transactions/unified/mongos-unpin.json index 2e17c5d2540..c01abf30768 100644 --- a/test/spec/transactions/unified/mongos-unpin.json +++ b/test/spec/transactions/unified/mongos-unpin.json @@ -1,6 +1,6 @@ { "description": "mongos-unpin", - "schemaVersion": "1.1", + "schemaVersion": "1.4", "runOnRequirements": [ { "minServerVersion": "4.2", @@ -50,6 +50,11 @@ "tests": [ { "description": "unpin after TransientTransctionError error on commit", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", @@ -138,6 +143,11 @@ }, { "description": "unpin after TransientTransctionError error on abort", + "runOnRequirements": [ + { + "serverless": "forbid" + } + ], "operations": [ { "name": "startTransaction", diff --git a/test/spec/transactions/unified/mongos-unpin.yml b/test/spec/transactions/unified/mongos-unpin.yml index e43071ddf8e..46433d8c453 100644 --- a/test/spec/transactions/unified/mongos-unpin.yml +++ b/test/spec/transactions/unified/mongos-unpin.yml @@ -1,6 +1,6 @@ description: mongos-unpin -schemaVersion: '1.1' +schemaVersion: '1.4' runOnRequirements: - minServerVersion: '4.2' @@ -34,6 +34,10 @@ _yamlAnchors: tests: - description: unpin after TransientTransctionError error on commit + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - &startTransaction name: startTransaction @@ -77,6 +81,10 @@ tests: - *assertNoPinnedServer - description: unpin after TransientTransctionError error on abort + runOnRequirements: + # serverless proxy doesn't append error labels to errors in transactions + # caused by failpoints (CLOUDP-88216) + - serverless: "forbid" operations: - *startTransaction - *insertOne diff --git a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json deleted file mode 100644 index 2c4f7d27e77..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "expectedEvent-additionalProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "foo": 0 - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml deleted file mode 100644 index c2c1cb5a7c3..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-additionalProperties.yml +++ /dev/null @@ -1,17 +0,0 @@ -description: "expectedEvent-additionalProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json deleted file mode 100644 index ea6078faae4..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandFailedEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandFailedEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml deleted file mode 100644 index 57504b78f80..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandFailedEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandFailedEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandFailedEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json deleted file mode 100644 index ee6eb50658b..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-additionalProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "foo": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml deleted file mode 100644 index 6ea724ddfbf..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-additionalProperties.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-additionalProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - foo: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json deleted file mode 100644 index 4c9483caf30..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-command-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml deleted file mode 100644 index 91ba129869c..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-command-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-command-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json deleted file mode 100644 index a5a66096a03..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml deleted file mode 100644 index 07c968cdd44..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json deleted file mode 100644 index dc040ec108c..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandStartedEvent-databaseName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml deleted file mode 100644 index 355d90d6f71..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandStartedEvent-databaseName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandStartedEvent-databaseName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - databaseName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json deleted file mode 100644 index 4a20e906b97..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandSucceededEvent-commandName-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandSucceededEvent": { - "commandName": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml deleted file mode 100644 index 740b377fa28..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-commandName-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandSucceededEvent-commandName-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandSucceededEvent: - commandName: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json deleted file mode 100644 index 54645427512..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "description": "expectedEvent-commandSucceededEvent-reply-type", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandSucceededEvent": { - "reply": 0 - } - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml b/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml deleted file mode 100644 index 5a4b35e272d..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-commandSucceededEvent-reply-type.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-commandSucceededEvent-reply-type" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandSucceededEvent: - reply: 0 diff --git a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json deleted file mode 100644 index f01441946fa..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "description": "expectedEvent-maxProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": {}, - "commandSucceededEvent": {} - } - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml deleted file mode 100644 index d349133ea19..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-maxProperties.yml +++ /dev/null @@ -1,18 +0,0 @@ -description: "expectedEvent-maxProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: {} - commandSucceededEvent: {} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json b/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json deleted file mode 100644 index ebcc4948940..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "description": "expectedEvent-minProperties", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [ - { - "name": "foo", - "object": "client0", - "expectEvents": [ - { - "client": "client0", - "events": [ - {} - ] - } - ] - } - ] - } - ] -} diff --git a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml b/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml deleted file mode 100644 index 88de63a898a..00000000000 --- a/test/spec/unified-test-format/invalid/expectedEvent-minProperties.yml +++ /dev/null @@ -1,17 +0,0 @@ -description: "expectedEvent-minProperties" - -schemaVersion: "1.0" - -createEntities: - - client: - id: &client0 "client0" - -tests: - - description: "foo" - operations: - - name: "foo" - object: *client0 - expectEvents: - - client: *client0 - events: - - {} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json new file mode 100644 index 00000000000..031fa539df9 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-enum", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": "foo" + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml new file mode 100644 index 00000000000..6db134500b0 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-enum.yml @@ -0,0 +1,10 @@ +description: "runOnRequirement-serverless-enum" + +schemaVersion: "1.4" + +runOnRequirements: + - serverless: "foo" + +tests: + - description: "foo" + operations: [] diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json new file mode 100644 index 00000000000..1aa41712f9f --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.json @@ -0,0 +1,15 @@ +{ + "description": "runOnRequirement-serverless-type", + "schemaVersion": "1.4", + "runOnRequirements": [ + { + "serverless": 1234 + } + ], + "tests": [ + { + "description": "foo", + "operations": [] + } + ] +} diff --git a/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml new file mode 100644 index 00000000000..82a7ed31d53 --- /dev/null +++ b/test/spec/unified-test-format/invalid/runOnRequirement-serverless-type.yml @@ -0,0 +1,10 @@ +description: runOnRequirement-serverless-type + +schemaVersion: '1.4' + +runOnRequirements: + - serverless: 1234 + +tests: + - description: foo + operations: [] diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.json b/test/spec/unified-test-format/valid-pass/poc-crud.json new file mode 100644 index 00000000000..0790d9b789f --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/poc-crud.json @@ -0,0 +1,450 @@ +{ + "description": "poc-crud", + "schemaVersion": "1.4", + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-tests" + } + }, + { + "database": { + "id": "database1", + "client": "client0", + "databaseName": "admin" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "coll0" + } + }, + { + "collection": { + "id": "collection1", + "database": "database0", + "collectionName": "coll1" + } + }, + { + "collection": { + "id": "collection2", + "database": "database0", + "collectionName": "coll2", + "collectionOptions": { + "readConcern": { + "level": "majority" + } + } + } + } + ], + "initialData": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + }, + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + }, + { + "collectionName": "coll2", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + }, + { + "collectionName": "aggregate_out", + "databaseName": "crud-tests", + "documents": [] + } + ], + "tests": [ + { + "description": "BulkWrite with mixed ordered operations", + "operations": [ + { + "name": "bulkWrite", + "object": "collection0", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 3, + "x": 33 + } + } + }, + { + "updateOne": { + "filter": { + "_id": 2 + }, + "update": { + "$inc": { + "x": 1 + } + } + } + }, + { + "updateMany": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + } + } + }, + { + "insertOne": { + "document": { + "_id": 4, + "x": 44 + } + } + }, + { + "deleteMany": { + "filter": { + "x": { + "$nin": [ + 24, + 34 + ] + } + } + } + }, + { + "replaceOne": { + "filter": { + "_id": 4 + }, + "replacement": { + "_id": 4, + "x": 44 + }, + "upsert": true + } + } + ], + "ordered": true + }, + "expectResult": { + "deletedCount": 2, + "insertedCount": 2, + "insertedIds": { + "$$unsetOrMatches": { + "0": 3, + "3": 4 + } + }, + "matchedCount": 3, + "modifiedCount": 3, + "upsertedCount": 1, + "upsertedIds": { + "5": 4 + } + } + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 2, + "x": 24 + }, + { + "_id": 3, + "x": 34 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] + }, + { + "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", + "operations": [ + { + "name": "insertMany", + "object": "collection1", + "arguments": { + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ], + "ordered": false + }, + "expectError": { + "expectResult": { + "$$unsetOrMatches": { + "deletedCount": 0, + "insertedCount": 2, + "matchedCount": 0, + "modifiedCount": 0, + "upsertedCount": 0, + "upsertedIds": {} + } + } + } + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "ReplaceOne prohibits atomic modifiers", + "operations": [ + { + "name": "replaceOne", + "object": "collection1", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "$set": { + "x": 22 + } + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ], + "outcome": [ + { + "collectionName": "coll1", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] + }, + { + "description": "readConcern majority with out stage", + "runOnRequirements": [ + { + "minServerVersion": "4.1.0", + "topologies": [ + "replicaset", + "sharded-replicaset" + ], + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection2", + "arguments": { + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "aggregate_out" + } + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll2", + "pipeline": [ + { + "$sort": { + "x": 1 + } + }, + { + "$match": { + "_id": { + "$gt": 1 + } + } + }, + { + "$out": "aggregate_out" + } + ], + "readConcern": { + "level": "majority" + } + }, + "commandName": "aggregate", + "databaseName": "crud-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "aggregate_out", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "Aggregate with $listLocalSessions", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "serverless": "forbid" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "database1", + "arguments": { + "pipeline": [ + { + "$listLocalSessions": {} + }, + { + "$limit": 1 + }, + { + "$addFields": { + "dummy": "dummy field" + } + }, + { + "$project": { + "_id": 0, + "dummy": 1 + } + } + ] + }, + "expectResult": [ + { + "dummy": "dummy field" + } + ] + } + ] + } + ] +} diff --git a/test/spec/unified-test-format/valid-pass/poc-crud.yml b/test/spec/unified-test-format/valid-pass/poc-crud.yml new file mode 100644 index 00000000000..b7d05d75afb --- /dev/null +++ b/test/spec/unified-test-format/valid-pass/poc-crud.yml @@ -0,0 +1,190 @@ +description: "poc-crud" + +schemaVersion: "1.4" + +createEntities: + - client: + id: &client0 client0 + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name crud-tests + - database: + id: &database1 database1 + client: *client0 + databaseName: &database1Name admin + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name coll0 + - collection: + id: &collection1 collection1 + database: *database0 + collectionName: &collection1Name coll1 + - collection: + id: &collection2 collection2 + database: *database0 + collectionName: &collection2Name coll2 + collectionOptions: + readConcern: { level: majority } + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - collectionName: *collection2Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - collectionName: &out aggregate_out + databaseName: *database0Name + documents: [] + +tests: + - description: "BulkWrite with mixed ordered operations" + operations: + - name: bulkWrite + object: *collection0 + arguments: + requests: + - insertOne: + document: { _id: 3, x: 33 } + - updateOne: + filter: { _id: 2 } + update: { $inc: { x: 1 } } + - updateMany: + filter: { _id: { $gt: 1 } } + update: { $inc: { x: 1 } } + - insertOne: + document: { _id: 4, x: 44 } + - deleteMany: + filter: { x: { $nin: [ 24, 34 ] } } + - replaceOne: + filter: { _id: 4 } + replacement: { _id: 4, x: 44 } + upsert: true + ordered: true + expectResult: + deletedCount: 2 + insertedCount: 2 + insertedIds: { $$unsetOrMatches: { 0: 3, 3: 4 } } + matchedCount: 3 + modifiedCount: 3 + upsertedCount: 1 + upsertedIds: { 5: 4 } + outcome: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - {_id: 2, x: 24 } + - {_id: 3, x: 34 } + - {_id: 4, x: 44 } + + - description: "InsertMany continue-on-error behavior with unordered (duplicate key in requests)" + operations: + - name: insertMany + object: *collection1 + arguments: + documents: + - { _id: 2, x: 22 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + ordered: false + expectError: + expectResult: + # insertMany throws BulkWriteException, which may optionally include + # an intermediary BulkWriteResult + $$unsetOrMatches: + deletedCount: 0 + insertedCount: 2 + # Since the map of insertedIds is generated before execution it + # could indicate inserts that did not actually succeed. We omit + # this field rather than expect drivers to provide an accurate + # map filtered by write errors. + matchedCount: 0 + modifiedCount: 0 + upsertedCount: 0 + upsertedIds: { } + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + + - description: "ReplaceOne prohibits atomic modifiers" + operations: + - name: replaceOne + object: *collection1 + arguments: + filter: { _id: 1 } + replacement: { $set: { x: 22 }} + expectError: + isClientError: true + expectEvents: + - client: *client0 + events: [] + outcome: + - collectionName: *collection1Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + + - description: "readConcern majority with out stage" + runOnRequirements: + - minServerVersion: "4.1.0" + topologies: [ replicaset, sharded-replicaset ] + serverless: "forbid" + operations: + - name: aggregate + object: *collection2 + arguments: + pipeline: &pipeline + - $sort: { x : 1 } + - $match: { _id: { $gt: 1 } } + - $out: *out + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection2Name + pipeline: *pipeline + readConcern: { level: majority } + # The following two assertions were not in the original test + commandName: aggregate + databaseName: *database0Name + outcome: + - collectionName: *out + databaseName: *database0Name + documents: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + + - description: "Aggregate with $listLocalSessions" + runOnRequirements: + - minServerVersion: "3.6.0" + # serverless does not support either of the current database-level aggregation stages ($listLocalSessions and + # $currentOp) + serverless: forbid + operations: + - name: aggregate + object: *database1 + arguments: + pipeline: + - $listLocalSessions: { } + - $limit: 1 + - $addFields: { dummy: "dummy field"} + - $project: { _id: 0, dummy: 1} + expectResult: + - { dummy: "dummy field" } diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json index 30c1d54152a..50160799f33 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.json @@ -298,9 +298,6 @@ }, "expectResult": { "$$unsetOrMatches": { - "insertedCount": { - "$$unsetOrMatches": 2 - }, "insertedIds": { "$$unsetOrMatches": { "0": 3, diff --git a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml index 47ded3a5fb5..fa882e28366 100644 --- a/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml +++ b/test/spec/unified-test-format/valid-pass/poc-retryable-writes.yml @@ -141,9 +141,8 @@ tests: - { _id: 4, x: 44 } ordered: true expectResult: - $$unsetOrMatches: - insertedCount: { $$unsetOrMatches: 2 } - insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } + # InsertManyResult is optional because all of its fields are optional + $$unsetOrMatches: { insertedIds: { $$unsetOrMatches: { 0: 3, 1: 4 } } } outcome: - collectionName: *collectionName databaseName: *databaseName From 9e48bbdc95149ca62fa21404624125b87c3c9d56 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Tue, 20 Jul 2021 12:35:45 -0400 Subject: [PATCH 7/8] fix(NODE-3199): unable to bundle driver due to uncaught require (#2904) --- package-lock.json | 705 +++++++++++++++++++++------------------------- package.json | 3 +- src/bson.ts | 1 + src/deps.ts | 4 + src/encrypter.ts | 7 +- 5 files changed, 325 insertions(+), 395 deletions(-) diff --git a/package-lock.json b/package-lock.json index f102ffa9073..473f0bb077f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -395,6 +395,29 @@ } } }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", + "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "dev": true + }, + "@hutson/parse-repository-url": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz", + "integrity": "sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q==", + "dev": true + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -466,23 +489,23 @@ "dev": true }, "@microsoft/api-extractor": { - "version": "7.16.1", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.16.1.tgz", - "integrity": "sha512-hKFoLdmEUbHMIH48MXzSg8rndiugrXHruMVk+BQvhu14yX3LxH9re1CKwj4vLZb7bVBn+FfaWSZ5d3ltiXvX3w==", + "version": "7.18.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.18.4.tgz", + "integrity": "sha512-Wx45VuIAu09Pk9Qwzt0I57OX31BaWO2r6+mfSXqYFsJjYTqwUkdFh92G1GKYgvuR9oF/ai7w10wrFpx5WZYbGg==", "dev": true, "requires": { - "@microsoft/api-extractor-model": "7.13.3", + "@microsoft/api-extractor-model": "7.13.4", "@microsoft/tsdoc": "0.13.2", "@microsoft/tsdoc-config": "~0.15.2", - "@rushstack/node-core-library": "3.39.0", - "@rushstack/rig-package": "0.2.12", - "@rushstack/ts-command-line": "4.7.10", + "@rushstack/node-core-library": "3.39.1", + "@rushstack/rig-package": "0.2.13", + "@rushstack/ts-command-line": "4.8.1", "colors": "~1.2.1", "lodash": "~4.17.15", "resolve": "~1.17.0", "semver": "~7.3.0", "source-map": "~0.6.1", - "typescript": "~4.3.2" + "typescript": "~4.3.5" }, "dependencies": { "semver": { @@ -497,14 +520,14 @@ } }, "@microsoft/api-extractor-model": { - "version": "7.13.3", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.13.3.tgz", - "integrity": "sha512-uXilAhu2GcvyY/0NwVRk3AN7TFYjkPnjHLV2UywTTz9uglS+Af0YjNrCy+aaK8qXtfbFWdBzkH9N2XU8/YBeRQ==", + "version": "7.13.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.13.4.tgz", + "integrity": "sha512-NYaR3hJinh089/Gkee8fvmEFf9zKkoUvNxgkqUlKBCDXH2+Ou4tNDuL8G6zjhKBPicHkp2VcL8l7q9H6txUkjQ==", "dev": true, "requires": { "@microsoft/tsdoc": "0.13.2", "@microsoft/tsdoc-config": "~0.15.2", - "@rushstack/node-core-library": "3.39.0" + "@rushstack/node-core-library": "3.39.1" } }, "@microsoft/tsdoc": { @@ -554,9 +577,9 @@ "dev": true }, "@nodelib/fs.walk": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz", - "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, "requires": { "@nodelib/fs.scandir": "2.1.5", @@ -564,9 +587,9 @@ } }, "@rushstack/node-core-library": { - "version": "3.39.0", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.39.0.tgz", - "integrity": "sha512-kgu3+7/zOBkZU0+NdJb1rcHcpk3/oTjn5c8cg5nUTn+JDjEw58yG83SoeJEcRNNdl11dGX0lKG2PxPsjCokZOQ==", + "version": "3.39.1", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.39.1.tgz", + "integrity": "sha512-HHgMEHZTXQ3NjpQzWd5+fSt2Eod9yFwj6qBPbaeaNtDNkOL8wbLoxVimQNtcH0Qhn4wxF5u2NTDNFsxf2yd1jw==", "dev": true, "requires": { "@types/node": "10.17.13", @@ -598,9 +621,9 @@ } }, "@rushstack/rig-package": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.2.12.tgz", - "integrity": "sha512-nbePcvF8hQwv0ql9aeQxcaMPK/h1OLAC00W7fWCRWIvD2MchZOE8jumIIr66HGrfG2X1sw++m/ZYI4D+BM5ovQ==", + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.2.13.tgz", + "integrity": "sha512-qQMAFKvfb2ooaWU9DrGIK9d8QfyHy/HiuITJbWenlKgzcDXQvQgEduk57YF4Y7LLasDJ5ZzLaaXwlfX8qCRe5Q==", "dev": true, "requires": { "resolve": "~1.17.0", @@ -608,9 +631,9 @@ } }, "@rushstack/ts-command-line": { - "version": "4.7.10", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.7.10.tgz", - "integrity": "sha512-8t042g8eerypNOEcdpxwRA3uCmz0duMo21rG4Z2mdz7JxJeylDmzjlU3wDdef2t3P1Z61JCdZB6fbm1Mh0zi7w==", + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.8.1.tgz", + "integrity": "sha512-rmxvYdCNRbyRs+DYAPye3g6lkCkWHleqO40K8UPvUAzFqEuj6+YCVssBiOmrUDCoM5gaegSNT0wFDYhz24DWtw==", "dev": true, "requires": { "@types/argparse": "1.0.38", @@ -691,9 +714,9 @@ "dev": true }, "@types/chai": { - "version": "4.2.19", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.19.tgz", - "integrity": "sha512-jRJgpRBuY+7izT7/WNXP/LsMO9YonsstuL+xuvycDyESpoDoIAsMd7suwpB4h9oEWB+ZlPTqJJ8EHomzNhwTPQ==", + "version": "4.2.21", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.21.tgz", + "integrity": "sha512-yd+9qKmJxm496BOV9CMNaey8TWsikaZOwMRwPHQIjcOJM9oV+fi9ZMNw3JsVnbEEbo2gRTDnGEBv8pjyn67hNg==", "dev": true }, "@types/chai-subset": { @@ -706,9 +729,9 @@ } }, "@types/eslint": { - "version": "7.2.13", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.13.tgz", - "integrity": "sha512-LKmQCWAlnVHvvXq4oasNUMTJJb2GwSyTY8+1C7OH5ILR8mPLaljv1jxL1bXW3xB3jFbQxTKxJAvI8PyjB09aBg==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==", "dev": true, "requires": { "@types/estree": "*", @@ -716,67 +739,83 @@ } }, "@types/estree": { - "version": "0.0.48", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.48.tgz", - "integrity": "sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==", + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", + "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", "dev": true }, "@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==", + "version": "7.0.8", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz", + "integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==", "dev": true }, "@types/kerberos": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@types/kerberos/-/kerberos-1.1.0.tgz", - "integrity": "sha512-ixpV6PSSMnIVpMNCLQ0gWguC2+pBxc0LeUCv9Ugj54opVSVFXfPNYP6sMa7UHvicYGDXAyHQSAzQC8VYEIgdFQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/kerberos/-/kerberos-1.1.1.tgz", + "integrity": "sha512-wNq/9L0nfaTd1ODdSzd0pRy7ktty9INd27uD18qYru5/F9AZGkC7cK9oDaXgrX9jkezOzi8gQVGGLqSXUCUEiQ==", "dev": true }, "@types/minimist": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.1.tgz", - "integrity": "sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", "dev": true }, "@types/mocha": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.2.tgz", - "integrity": "sha512-Lwh0lzzqT5Pqh6z61P3c3P5nm6fzQK/MMHl9UKeneAeInVflBSz1O2EkX6gM6xfJd7FBXBY5purtLx7fUiZ7Hw==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.3.tgz", + "integrity": "sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw==", "dev": true }, "@types/node": { - "version": "15.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.5.tgz", - "integrity": "sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==", + "version": "15.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.14.2.tgz", + "integrity": "sha512-dvMUE/m2LbXPwlvVuzCyslTEtQ2ZwuuFClDrOQ6mp2CenCg971719PTILZ4I6bTP27xfFFc+o7x2TkLuun/MPw==", "dev": true }, "@types/normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==", "dev": true }, "@types/saslprep": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/saslprep/-/saslprep-1.0.0.tgz", - "integrity": "sha512-nh/fE/f/a8k6hF62GWNdw5kpR25SQyk1xvWLsJSoWLLvLFBRmT6rdCSUepuxuGGuwBDC+QcaIHqPoZ4ZRjxFBg==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/saslprep/-/saslprep-1.0.1.tgz", + "integrity": "sha512-JHSoEmJi4Gav2Y53dIGdvW2w2tr8iymXWhI/qNiKx9/eSgREsJkn7gJK22ldVXuisQXreSyXqogtzRtT0ls8Lg==", "dev": true }, "@types/semver": { - "version": "7.3.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.6.tgz", - "integrity": "sha512-0caWDWmpCp0uifxFh+FaqK3CuZ2SkRR/ZRxAV5+zNdC3QVUi6wyOJnefhPvtNt8NQWXB5OA93BUvZsXpWat2Xw==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-4g1jrL98mdOIwSOUh6LTlB0Cs9I0dQPwINUhBg7C6pN4HLr8GS8xsksJxilW6S6dQHVi2K/o+lQuQcg7LroCnw==", + "dev": true + }, + "@types/webidl-conversions": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-6.1.1.tgz", + "integrity": "sha512-XAahCdThVuCFDQLT7R7Pk/vqeObFNL3YqRyFZg+AqAP/W1/w3xHaIxuW7WszQqTbIBOPRcItYJIou3i/mppu3Q==", "dev": true }, + "@types/whatwg-url": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.1.tgz", + "integrity": "sha512-2YubE1sjj5ifxievI5Ge1sckb9k/Er66HyR2c+3+I6VDUUg1TLPdYYTEbQ+DjRkS4nTxMJhgWfSfMRD2sl2EYQ==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/webidl-conversions": "*" + } + }, "@typescript-eslint/eslint-plugin": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.1.tgz", - "integrity": "sha512-9yfcNpDaNGQ6/LQOX/KhUFTR1sCKH+PBr234k6hI9XJ0VP5UqGxap0AnNwBnWFk1MNyWBylJH9ZkzBXC+5akZQ==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.28.3.tgz", + "integrity": "sha512-jW8sEFu1ZeaV8xzwsfi6Vgtty2jf7/lJmQmDkDruBjYAbx5DA8JtbcMnP0rNPUG+oH5GoQBTSp+9613BzuIpYg==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.28.1", - "@typescript-eslint/scope-manager": "4.28.1", + "@typescript-eslint/experimental-utils": "4.28.3", + "@typescript-eslint/scope-manager": "4.28.3", "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.1.0", @@ -796,55 +835,55 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.1.tgz", - "integrity": "sha512-n8/ggadrZ+uyrfrSEchx3jgODdmcx7MzVM2sI3cTpI/YlfSm0+9HEUaWw3aQn2urL2KYlWYMDgn45iLfjDYB+Q==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.28.3.tgz", + "integrity": "sha512-zZYl9TnrxwEPi3FbyeX0ZnE8Hp7j3OCR+ELoUfbwGHGxWnHg9+OqSmkw2MoCVpZksPCZYpQzC559Ee9pJNHTQw==", "dev": true, "requires": { "@types/json-schema": "^7.0.7", - "@typescript-eslint/scope-manager": "4.28.1", - "@typescript-eslint/types": "4.28.1", - "@typescript-eslint/typescript-estree": "4.28.1", + "@typescript-eslint/scope-manager": "4.28.3", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/typescript-estree": "4.28.3", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" } }, "@typescript-eslint/parser": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.1.tgz", - "integrity": "sha512-UjrMsgnhQIIK82hXGaD+MCN8IfORS1CbMdu7VlZbYa8LCZtbZjJA26De4IPQB7XYZbL8gJ99KWNj0l6WD0guJg==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.28.3.tgz", + "integrity": "sha512-ZyWEn34bJexn/JNYvLQab0Mo5e+qqQNhknxmc8azgNd4XqspVYR5oHq9O11fLwdZMRcj4by15ghSlIEq+H5ltQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.28.1", - "@typescript-eslint/types": "4.28.1", - "@typescript-eslint/typescript-estree": "4.28.1", + "@typescript-eslint/scope-manager": "4.28.3", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/typescript-estree": "4.28.3", "debug": "^4.3.1" } }, "@typescript-eslint/scope-manager": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.1.tgz", - "integrity": "sha512-o95bvGKfss6705x7jFGDyS7trAORTy57lwJ+VsYwil/lOUxKQ9tA7Suuq+ciMhJc/1qPwB3XE2DKh9wubW8YYA==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.28.3.tgz", + "integrity": "sha512-/8lMisZ5NGIzGtJB+QizQ5eX4Xd8uxedFfMBXOKuJGP0oaBBVEMbJVddQKDXyyB0bPlmt8i6bHV89KbwOelJiQ==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.1", - "@typescript-eslint/visitor-keys": "4.28.1" + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3" } }, "@typescript-eslint/types": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.1.tgz", - "integrity": "sha512-4z+knEihcyX7blAGi7O3Fm3O6YRCP+r56NJFMNGsmtdw+NCdpG5SgNz427LS9nQkRVTswZLhz484hakQwB8RRg==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.28.3.tgz", + "integrity": "sha512-kQFaEsQBQVtA9VGVyciyTbIg7S3WoKHNuOp/UF5RG40900KtGqfoiETWD/v0lzRXc+euVE9NXmfer9dLkUJrkA==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.1.tgz", - "integrity": "sha512-GhKxmC4sHXxHGJv8e8egAZeTZ6HI4mLU6S7FUzvFOtsk7ZIDN1ksA9r9DyOgNqowA9yAtZXV0Uiap61bIO81FQ==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.28.3.tgz", + "integrity": "sha512-YAb1JED41kJsqCQt1NcnX5ZdTA93vKFCMP4lQYG6CFxd0VzDJcKttRlMrlG+1qiWAw8+zowmHU1H0OzjWJzR2w==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.1", - "@typescript-eslint/visitor-keys": "4.28.1", + "@typescript-eslint/types": "4.28.3", + "@typescript-eslint/visitor-keys": "4.28.3", "debug": "^4.3.1", "globby": "^11.0.3", "is-glob": "^4.0.1", @@ -864,12 +903,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.1.tgz", - "integrity": "sha512-K4HMrdFqr9PFquPu178SaSb92CaWe2yErXyPumc8cYWxFmhgJsNY9eSePmO05j0JhBvf2Cdhptd6E6Yv9HVHcg==", + "version": "4.28.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.28.3.tgz", + "integrity": "sha512-ri1OzcLnk1HH4gORmr1dllxDzzrN6goUIz/P4MHFV0YZJDCADPR3RvYNp0PW2SetKTThar6wlbFTL00hV2Q+fg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.28.1", + "@typescript-eslint/types": "4.28.3", "eslint-visitor-keys": "^2.0.0" } }, @@ -890,9 +929,9 @@ "dev": true }, "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true }, "add-stream": { @@ -1055,12 +1094,6 @@ "sprintf-js": "~1.0.2" } }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, "array-from": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", @@ -1227,9 +1260,9 @@ } }, "bson": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.4.0.tgz", - "integrity": "sha512-uX9Zqzv2DpFXJgQOWKD8nbf0dTQV57WM8eiXDXVWeJYgiu/zIRz61OGLJKwbfSEEjZJ+AgS+7TUT7Y8EloTaqQ==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-4.4.1.tgz", + "integrity": "sha512-Uu4OCZa0jouQJCKOk1EmmyqtdWAP5HVLru4lQxTwzJzxT+sJ13lVpEZU/MATDxtHiekWMAL84oQY3Xn1LpJVSg==", "requires": { "buffer": "^5.6.0" } @@ -1317,9 +1350,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001241", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz", - "integrity": "sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==", + "version": "1.0.30001245", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001245.tgz", + "integrity": "sha512-768fM9j1PKXpOCKws6eTo3RHmvTUsG9UrpT4WoREFeZgJBTi4/X9g565azS/rVUGtqb8nt7FjLeF5u4kukERnA==", "dev": true }, "caseless": { @@ -1638,16 +1671,16 @@ } }, "conventional-changelog-core": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-4.2.2.tgz", - "integrity": "sha512-7pDpRUiobQDNkwHyJG7k9f6maPo9tfPzkSWbRq97GGiZqisElhnvUZSvyQH20ogfOjntB5aadvv6NNcKL1sReg==", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-4.2.3.tgz", + "integrity": "sha512-MwnZjIoMRL3jtPH5GywVNqetGILC7g6RQFvdb8LRU/fA/338JbeWAku3PZ8yQ+mtVRViiISqJlb0sOz0htBZig==", "dev": true, "requires": { "add-stream": "^1.0.0", - "conventional-changelog-writer": "^4.0.18", + "conventional-changelog-writer": "^5.0.0", "conventional-commits-parser": "^3.2.0", "dateformat": "^3.0.0", - "get-pkg-repo": "^1.0.0", + "get-pkg-repo": "^4.0.0", "git-raw-commits": "^2.0.8", "git-remote-origin-url": "^2.0.0", "git-semver-tags": "^4.1.1", @@ -1656,7 +1689,6 @@ "q": "^1.5.1", "read-pkg": "^3.0.0", "read-pkg-up": "^3.0.0", - "shelljs": "^0.8.3", "through2": "^4.0.0" }, "dependencies": { @@ -1724,12 +1756,11 @@ "dev": true }, "conventional-changelog-writer": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.1.0.tgz", - "integrity": "sha512-WwKcUp7WyXYGQmkLsX4QmU42AZ1lqlvRW9mqoyiQzdD+rJWbTepdWoKJuwXTS+yq79XKnQNa93/roViPQrAQgw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.0.tgz", + "integrity": "sha512-HnDh9QHLNWfL6E1uHz6krZEQOgm8hN7z/m7tT16xwd802fwgMN0Wqd7AQYVkhpsjDUx/99oo+nGgvKF657XP5g==", "dev": true, "requires": { - "compare-func": "^2.0.0", "conventional-commits-filter": "^2.0.7", "dateformat": "^3.0.0", "handlebars": "^4.7.6", @@ -1863,15 +1894,6 @@ "which": "^2.0.1" } }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, "dargs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", @@ -1894,9 +1916,9 @@ "dev": true }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -2255,9 +2277,9 @@ } }, "electron-to-chromium": { - "version": "1.3.761", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.761.tgz", - "integrity": "sha512-7a/wV/plM/b95XjTdA2Q4zAxxExTDKkNQpTiaU/nVT8tGCQVtX9NsnTjhALBFICpOB58hU6xg5fFC3CT2Bybpg==", + "version": "1.3.775", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.775.tgz", + "integrity": "sha512-EGuiJW4yBPOTj2NtWGZcX93ZE8IGj33HJAx4d3ouE2zOfW2trbWU+t1e0yzLr1qQIw81++txbM3BH52QwSRE6Q==", "dev": true }, "emoji-regex": { @@ -2446,13 +2468,14 @@ } }, "eslint": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.29.0.tgz", - "integrity": "sha512-82G/JToB9qIy/ArBzIWG9xvvwL3R86AlCjtGw+A29OMZDqhTybz/MByORSukGxeI+YPCR4coYyITKk8BFH9nDA==", + "version": "7.30.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.30.0.tgz", + "integrity": "sha512-VLqz80i3as3NdloY44BQSJpFw534L9Oh+6zJOUaViV4JPd+DaHwutqP7tcpkW3YiXbK6s05RZl7yl7cQn+lijg==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", "@eslint/eslintrc": "^0.4.2", + "@humanwhocodes/config-array": "^0.5.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2597,9 +2620,9 @@ } }, "eslint-rule-docs": { - "version": "1.1.229", - "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.229.tgz", - "integrity": "sha512-blQpqOoFiGr9wcH+MEgfMHcxizaXUaXXEc07R0avaZeivVmoPhvepHsh1UfdbtvC/KNZPcLzdpPIEpZIdgUSdQ==", + "version": "1.1.230", + "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.230.tgz", + "integrity": "sha512-dT3rxxc3TmP57RHm9OYTQhT0N4Yu7bjkBW0hvrGRO5sUhB2ron8KPxMDE6pgO44oHvccrsB6TYlCCM5jccdPHw==", "dev": true }, "eslint-scope": { @@ -2729,9 +2752,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.6.tgz", - "integrity": "sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -2754,9 +2777,9 @@ "dev": true }, "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", + "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -2882,9 +2905,9 @@ } }, "flatted": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", - "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.1.tgz", + "integrity": "sha512-OMQjaErSFHmHqZe+PSidH5n8j3O0F2DdnVh8JB4j4eUQ2k6KvB0qGfrKIhapvez5JerBbmWkaLYUYWISaESoXg==", "dev": true }, "flatten": { @@ -3082,87 +3105,53 @@ "dev": true }, "get-pkg-repo": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", - "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-4.1.2.tgz", + "integrity": "sha512-/FjamZL9cBYllEbReZkxF2IMh80d8TJoC4e3bmLNif8ibHw95aj0N/tzqK0kZz9eU/3w3dL6lF4fnnX/sDdW3A==", "dev": true, "requires": { - "hosted-git-info": "^2.1.4", - "meow": "^3.3.0", - "normalize-package-data": "^2.3.0", - "parse-github-repo-url": "^1.3.0", + "@hutson/parse-repository-url": "^3.0.0", + "hosted-git-info": "^4.0.0", + "meow": "^7.0.0", "through2": "^2.0.0" }, "dependencies": { - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - } - }, "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" } }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "repeating": "^2.0.0" + "p-locate": "^4.1.0" } }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-7.1.1.tgz", + "integrity": "sha512-GWHvA5QOcS412WCo8vwKDlTelGLsCGBVevQB5Kva961rmNfun0PCbv5+xta2kUMFJyR8/oWnn7ddeKdosbAPbA==", "dev": true, "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^2.5.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.13.1", + "yargs-parser": "^18.1.3" } }, "normalize-package-data": { @@ -3175,47 +3164,68 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + } } }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "pinkie-promise": "^2.0.0" + "p-limit": "^2.2.0" } }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true }, "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true + } } }, "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", "dev": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } } }, "readable-stream": { @@ -3233,16 +3243,6 @@ "util-deprecate": "~1.0.1" } }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3258,15 +3258,6 @@ "safe-buffer": "~5.1.0" } }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -3277,11 +3268,21 @@ "xtend": "~4.0.1" } }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", "dev": true + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, @@ -3391,9 +3392,9 @@ } }, "globals": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", - "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.10.0.tgz", + "integrity": "sha512-piHC3blgLGFjvOuMmWZX60f+na1lXFDhQXBf1UYp2fXPXqvEUbOhNwi6BsQ0bQishwedgnjkwv1d9zKf+MWw3g==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -3683,9 +3684,9 @@ "dev": true }, "is-core-module": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.4.0.tgz", - "integrity": "sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", + "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", "dev": true, "requires": { "has": "^1.0.3" @@ -3703,12 +3704,6 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, - "is-finite": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", - "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", - "dev": true - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -3830,12 +3825,6 @@ "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", "dev": true }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -4146,35 +4135,38 @@ } }, "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", "dev": true, "requires": { "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" }, "dependencies": { "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", "dev": true, "requires": { - "error-ex": "^1.2.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true } } }, @@ -4263,16 +4255,6 @@ "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", "dev": true }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4874,9 +4856,9 @@ } }, "mongodb-connection-string-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-1.0.0.tgz", - "integrity": "sha512-s2kSyqM/PgvLHKzc67eK/syC4n2eXu4Q2XWA4gJOgMvOk1/bsZ8jW04EBFabfNHgw66gYSovx9F623eKEkpfGA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-1.0.1.tgz", + "integrity": "sha512-sXi8w9nwbMrErWbOK+8nofHz531rboasDbYAMS+sQ+W+2YnHN980RlMr+t5SDL6uKEU/kw/wG6jcjCTLiJltoA==", "requires": { "whatwg-url": "^8.4.0" } @@ -5214,9 +5196,9 @@ "dev": true }, "object-inspect": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.3.tgz", - "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", "dev": true }, "object-keys": { @@ -5383,12 +5365,6 @@ "callsites": "^3.0.0" } }, - "parse-github-repo-url": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", - "integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A=", - "dev": true - }, "parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -5478,21 +5454,6 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -5790,18 +5751,6 @@ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, - "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" - } - }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -5814,16 +5763,6 @@ "validate-npm-package-license": "^3.0.1" } }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, "path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", @@ -5838,12 +5777,6 @@ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true } } }, @@ -5962,15 +5895,6 @@ "es6-error": "^4.0.1" } }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -6396,9 +6320,9 @@ } }, "standard-version": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/standard-version/-/standard-version-9.3.0.tgz", - "integrity": "sha512-cYxxKXhYfI3S9+CA84HmrJa9B88H56V5FQ302iFF2TNwJukJCNoU8FgWt+11YtwKFXRkQQFpepC2QOF7aDq2Ow==", + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/standard-version/-/standard-version-9.3.1.tgz", + "integrity": "sha512-5qMxXw/FxLouC5nANyx/5RY1kiorJx9BppUso8gN07MG64q2uLRmrPb4KfXp3Ql4s/gxjZwZ89e0FwxeLubGww==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -6740,9 +6664,9 @@ }, "dependencies": { "ajv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz", - "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==", + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.1.tgz", + "integrity": "sha512-42VLtQUOLefAvKFAQIxIZDaThq6om/PrfP0CYk3/vn+y4BMNkKnbli8ON2QCiHov4KkzOSJ/xSoBJdayiiYvVQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -6974,9 +6898,9 @@ "dev": true }, "ts-node": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.0.0.tgz", - "integrity": "sha512-ROWeOIUvfFbPZkoDis0L/55Fk+6gFQNZwwKPLinacRl6tsxstTF1DbAcLKkovwnpKMVvOMHP1TIbnwXwtLg1gg==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.1.0.tgz", + "integrity": "sha512-6szn3+J9WyG2hE+5W8e0ruZrzyk1uFLYye6IGMBadnOzDh8aP7t8CbFpsfCiEx2+wMixAhjFt7lOZC4+l+WbEA==", "dev": true, "requires": { "@tsconfig/node10": "^1.0.7", @@ -7014,9 +6938,9 @@ }, "dependencies": { "@tsd/typescript": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.3.4.tgz", - "integrity": "sha512-o5nx5an9JK+SUN/UiMmVwG3Eg+SsGrtdMtrw82bpZetMO2PkXBERgsf5KxsuPw3qm576z1R/SEUQRb1KaKGlOQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-Xwxv8bIwyI3ggPz9bwoWEoiaz79MJs+VGf27S1N2tapfDVo60Lz741j5diL9RwszZSXt6IkTAuw7Lai7jSXRJg==", "dev": true }, "find-up": { @@ -7211,14 +7135,13 @@ } }, "typedoc": { - "version": "0.21.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.2.tgz", - "integrity": "sha512-SR1ByJB3USg+jxoxwzMRP07g/0f/cQUE5t7gOh1iTUyjTPyJohu9YSKRlK+MSXXqlhIq+m0jkEHEG5HoY7/Adg==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.21.4.tgz", + "integrity": "sha512-slZQhvD9U0d9KacktYAyuNMMOXJRFNHy+Gd8xY2Qrqq3eTTTv3frv3N4au/cFnab9t3T5WA0Orb6QUjMc+1bDA==", "dev": true, "requires": { "glob": "^7.1.7", "handlebars": "^4.7.7", - "lodash": "^4.17.21", "lunr": "^2.3.9", "marked": "^2.1.1", "minimatch": "^3.0.0", @@ -7234,9 +7157,9 @@ "dev": true }, "typescript": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.4.tgz", - "integrity": "sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", "dev": true }, "typescript-cached-transpile": { @@ -7251,9 +7174,9 @@ }, "dependencies": { "@types/node": { - "version": "12.20.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.15.tgz", - "integrity": "sha512-F6S4Chv4JicJmyrwlDkxUdGNSplsQdGwp1A0AJloEVDirWdZOAiRHhovDlsFkKUrquUXhz1imJhXHsf59auyAg==", + "version": "12.20.16", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.16.tgz", + "integrity": "sha512-6CLxw83vQf6DKqXxMPwl8qpF8I7THFZuIwLt4TnNsumxkp1VsRZWT8txQxncT/Rl2UojTsFzWgDG4FRMwafrlA==", "dev": true }, "fs-extra": { diff --git a/package.json b/package.json index 082a77cdd2f..bb747acc87c 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dependencies": { "bson": "^4.4.0", "denque": "^1.5.0", - "mongodb-connection-string-url": "^1.0.0" + "mongodb-connection-string-url": "^1.0.1" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", @@ -54,6 +54,7 @@ "@types/node": "^15.3.1", "@types/saslprep": "^1.0.0", "@types/semver": "^7.3.4", + "@types/whatwg-url": "^8.2.1", "@typescript-eslint/eslint-plugin": "^4.19.0", "@typescript-eslint/parser": "^4.19.0", "chai": "^4.2.0", diff --git a/src/bson.ts b/src/bson.ts index 8cf5aab9dcf..3b445109daf 100644 --- a/src/bson.ts +++ b/src/bson.ts @@ -7,6 +7,7 @@ import type { // eslint-disable-next-line @typescript-eslint/no-var-requires let BSON = require('bson'); try { + // Ensure you always wrap an optional require in the try block NODE-3199 BSON = require('bson-ext'); } catch {} // eslint-disable-line diff --git a/src/deps.ts b/src/deps.ts index 47ae9d85400..35858bae2f4 100644 --- a/src/deps.ts +++ b/src/deps.ts @@ -27,6 +27,7 @@ export let Kerberos: ); try { + // Ensure you always wrap an optional require in the try block NODE-3199 Kerberos = require('kerberos'); } catch {} // eslint-disable-line @@ -47,6 +48,7 @@ export let Snappy: typeof import('snappy') | { kModuleError: MongoDriverError } ); try { + // Ensure you always wrap an optional require in the try block NODE-3199 Snappy = require('snappy'); } catch {} // eslint-disable-line @@ -60,6 +62,7 @@ export let saslprep: ); try { + // Ensure you always wrap an optional require in the try block NODE-3199 saslprep = require('saslprep'); } catch {} // eslint-disable-line @@ -70,6 +73,7 @@ export let aws4: typeof import('aws4') | { kModuleError: MongoDriverError } = ma ); try { + // Ensure you always wrap an optional require in the try block NODE-3199 aws4 = require('aws4'); } catch {} // eslint-disable-line diff --git a/src/encrypter.ts b/src/encrypter.ts index 0665d1166de..8b5cd83ea78 100644 --- a/src/encrypter.ts +++ b/src/encrypter.ts @@ -103,8 +103,10 @@ export class Encrypter { } static checkForMongoCrypt(): void { + let mongodbClientEncryption = undefined; try { - require.resolve('mongodb-client-encryption'); + // Ensure you always wrap an optional require in the try block NODE-3199 + mongodbClientEncryption = require('mongodb-client-encryption'); } catch (err) { throw new MongoDriverError( 'Auto-encryption requested, but the module is not installed. ' + @@ -112,8 +114,7 @@ export class Encrypter { ); } - const mongodbClientEncryption = require('mongodb-client-encryption'); - if (typeof mongodbClientEncryption.extension !== 'function') { + if (typeof mongodbClientEncryption?.extension !== 'function') { throw new MongoDriverError( 'loaded version of `mongodb-client-encryption` does not have property `extension`. ' + 'Please make sure you are loading the correct version of `mongodb-client-encryption`' From ac526055ca68a7100da4b2a0521027468b8d0aeb Mon Sep 17 00:00:00 2001 From: Daria Pardue <81593090+dariakp@users.noreply.github.com> Date: Tue, 20 Jul 2021 16:39:51 -0400 Subject: [PATCH 8/8] chore(release): 4.0.1 --- HISTORY.md | 14 ++++++++++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 12e93092fb7..b72da7f3d60 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [4.0.1](https://github.com/mongodb/node-mongodb-native/compare/v4.0.0...v4.0.1) (2021-07-20) + + +### Features + +* **NODE-3419:** define MongoRuntimeError children ([#2893](https://github.com/mongodb/node-mongodb-native/issues/2893)) ([eadeb01](https://github.com/mongodb/node-mongodb-native/commit/eadeb01ec689c72032a9c21e3e8486001a026945)) + + +### Bug Fixes + +* **NODE-3199:** unable to bundle driver due to uncaught require ([#2904](https://github.com/mongodb/node-mongodb-native/issues/2904)) ([9e48bbd](https://github.com/mongodb/node-mongodb-native/commit/9e48bbdc95149ca62fa21404624125b87c3c9d56)) +* **NODE-3393:** snapshot time not applied if distinct executed first ([#2908](https://github.com/mongodb/node-mongodb-native/issues/2908)) ([7aa3008](https://github.com/mongodb/node-mongodb-native/commit/7aa3008d58b9d9869c2ea4af7809fa6b5cfbf6f4)) +* **NODE-3417:** allow calling `db()` before MongoClient is connected ([#2889](https://github.com/mongodb/node-mongodb-native/issues/2889)) ([51ea86d](https://github.com/mongodb/node-mongodb-native/commit/51ea86d0abfbe18a3ae0a5e41a6b8c5b974f3c3b)) + ## [4.0.0](https://github.com/mongodb/node-mongodb-native/compare/v4.0.0-beta.6...v4.0.0) (2021-07-13) diff --git a/package-lock.json b/package-lock.json index 473f0bb077f..3aec98eaf32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mongodb", - "version": "4.0.0", + "version": "4.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bb747acc87c..6074d01760c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mongodb", - "version": "4.0.0", + "version": "4.0.1", "description": "The official MongoDB driver for Node.js", "main": "lib/index.js", "files": [