diff --git a/source/client-side-operations-timeout/etc/generate-basic-tests.py b/source/client-side-operations-timeout/etc/generate-basic-tests.py index f52f749b8c..e70751c101 100644 --- a/source/client-side-operations-timeout/etc/generate-basic-tests.py +++ b/source/client-side-operations-timeout/etc/generate-basic-tests.py @@ -63,7 +63,7 @@ # operations. Individual generation functions can choose to include them if needed. OPERATIONS = CLIENT_OPERATIONS + DB_OPERATIONS + COLLECTION_OPERATIONS -RETRYABLE_WRITE_OPERATIONS = [op for op in OPERATIONS if op.operation_name in +RETRYABLE_WRITE_OPERATIONS = [op for op in OPERATIONS if op.operation_name in ['insertOne', 'updateOne', 'deleteOne', 'replaceOne', 'findOneAndDelete', 'findOneAndUpdate', 'findOneAndReplace', 'insertMany', 'bulkWrite'] ] @@ -102,28 +102,33 @@ def generate(name, operations): } write_yaml(name, template, injections) -def generate_global_timeout_tests(): - generate('global-timeoutMS', OPERATIONS) - -def generate_override_db(): - generate('override-database-timeoutMS', DB_OPERATIONS + COLLECTION_OPERATIONS) - -def generate_override_coll(): - generate('override-collection-timeoutMS', COLLECTION_OPERATIONS) - -def generate_override_operation(): - generate('override-operation-timeoutMS', OPERATIONS) +# TODO(DRIVERS-3266): Investigate dropping generator script for index-related +# timeoutMS tests +#def generate_global_timeout_tests(): +# generate('global-timeoutMS', OPERATIONS) +# +#def generate_override_db(): +# generate('override-database-timeoutMS', DB_OPERATIONS + COLLECTION_OPERATIONS) +# +#def generate_override_coll(): +# generate('override-collection-timeoutMS', COLLECTION_OPERATIONS) +# +#def generate_override_operation(): +# generate('override-operation-timeoutMS', OPERATIONS) +# +#def generate_deprecated(): +# generate('deprecated-options', OPERATIONS) def generate_retryable(): generate('retryability-timeoutMS', RETRYABLE_WRITE_OPERATIONS + RETRYABLE_READ_OPERATIONS) generate('retryability-legacy-timeouts', RETRYABLE_WRITE_OPERATIONS + RETRYABLE_READ_OPERATIONS) -def generate_deprecated(): - generate('deprecated-options', OPERATIONS) +# TODO(DRIVERS-3266): Investigate dropping generator script for index-related +# timeoutMS tests +#generate_global_timeout_tests() +#generate_override_db() +#generate_override_coll() +#generate_override_operation() +#generate_deprecated() -generate_global_timeout_tests() -generate_override_db() -generate_override_coll() -generate_override_operation() generate_retryable() -generate_deprecated() diff --git a/source/client-side-operations-timeout/tests/deprecated-options.json b/source/client-side-operations-timeout/tests/deprecated-options.json index d3e4631ff4..647e1bf792 100644 --- a/source/client-side-operations-timeout/tests/deprecated-options.json +++ b/source/client-side-operations-timeout/tests/deprecated-options.json @@ -6750,16 +6750,23 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "timeoutMS": 100000, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "timeoutMS": 100000, "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ] @@ -6815,16 +6822,23 @@ ] } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "timeoutMS": 100000, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "timeoutMS": 100000, "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -6832,6 +6846,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", @@ -6903,6 +6923,16 @@ ] } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", @@ -6910,10 +6940,6 @@ "timeoutMS": 1000, "maxTimeMS": 5000, "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -6921,6 +6947,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", @@ -7003,6 +7035,17 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1", + "timeoutMS": 100000 + } + }, { "name": "dropIndexes", "object": "collection", diff --git a/source/client-side-operations-timeout/tests/deprecated-options.yml b/source/client-side-operations-timeout/tests/deprecated-options.yml index 582a8983ae..e3378d5fa8 100644 --- a/source/client-side-operations-timeout/tests/deprecated-options.yml +++ b/source/client-side-operations-timeout/tests/deprecated-options.yml @@ -3743,16 +3743,19 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 5 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + timeoutMS: 100000 + name: "x_1" - name: dropIndex object: *collection arguments: timeoutMS: 100000 name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false - - description: "wTimeoutMS is ignored if timeoutMS is set - dropIndex on collection" operations: - name: createEntities @@ -3781,18 +3784,26 @@ tests: - session: id: &session session client: *client + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + timeoutMS: 100000 + name: "x_1" - name: dropIndex object: *collection arguments: timeoutMS: 100000 name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -3828,19 +3839,26 @@ tests: - session: id: &session session client: *client + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: timeoutMS: &timeoutMS 1000 maxTimeMS: 5000 name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -3884,6 +3902,14 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 5 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" + timeoutMS: 100000 - name: dropIndexes object: *collection arguments: @@ -3979,4 +4005,4 @@ tests: command: dropIndexes: *collectionName maxTimeMS: { $$lte: *timeoutMS } - \ No newline at end of file + diff --git a/source/client-side-operations-timeout/tests/global-timeoutMS.json b/source/client-side-operations-timeout/tests/global-timeoutMS.json index 740bbad2e2..f1edbe68e3 100644 --- a/source/client-side-operations-timeout/tests/global-timeoutMS.json +++ b/source/client-side-operations-timeout/tests/global-timeoutMS.json @@ -5621,15 +5621,21 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -5637,6 +5643,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", diff --git a/source/client-side-operations-timeout/tests/global-timeoutMS.yml b/source/client-side-operations-timeout/tests/global-timeoutMS.yml index 7b4a78ac78..847c26f096 100644 --- a/source/client-side-operations-timeout/tests/global-timeoutMS.yml +++ b/source/client-side-operations-timeout/tests/global-timeoutMS.yml @@ -3120,17 +3120,24 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -3233,4 +3240,4 @@ tests: command: dropIndexes: *collectionName maxTimeMS: { $$exists: false } - \ No newline at end of file + diff --git a/source/client-side-operations-timeout/tests/override-collection-timeoutMS.json b/source/client-side-operations-timeout/tests/override-collection-timeoutMS.json index d17e22fc2f..c56d45bcbb 100644 --- a/source/client-side-operations-timeout/tests/override-collection-timeoutMS.json +++ b/source/client-side-operations-timeout/tests/override-collection-timeoutMS.json @@ -3251,15 +3251,21 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -3267,6 +3273,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", @@ -3327,15 +3339,21 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -3343,6 +3361,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", diff --git a/source/client-side-operations-timeout/tests/override-collection-timeoutMS.yml b/source/client-side-operations-timeout/tests/override-collection-timeoutMS.yml index d1d1c61056..07e2a14429 100644 --- a/source/client-side-operations-timeout/tests/override-collection-timeoutMS.yml +++ b/source/client-side-operations-timeout/tests/override-collection-timeoutMS.yml @@ -1745,17 +1745,24 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -1785,17 +1792,24 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -1874,4 +1888,4 @@ tests: command: dropIndexes: *collectionName maxTimeMS: { $$exists: false } - \ No newline at end of file + diff --git a/source/client-side-operations-timeout/tests/override-database-timeoutMS.json b/source/client-side-operations-timeout/tests/override-database-timeoutMS.json index f7fa642c58..11ff7a59fd 100644 --- a/source/client-side-operations-timeout/tests/override-database-timeoutMS.json +++ b/source/client-side-operations-timeout/tests/override-database-timeoutMS.json @@ -4354,15 +4354,21 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -4370,6 +4376,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", @@ -4437,15 +4449,21 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "name": "x_1" - }, - "expectError": { - "isClientError": false, - "isTimeoutError": false } } ], @@ -4453,6 +4471,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", diff --git a/source/client-side-operations-timeout/tests/override-database-timeoutMS.yml b/source/client-side-operations-timeout/tests/override-database-timeoutMS.yml index aed7b43720..4ded17164d 100644 --- a/source/client-side-operations-timeout/tests/override-database-timeoutMS.yml +++ b/source/client-side-operations-timeout/tests/override-database-timeoutMS.yml @@ -2343,17 +2343,24 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -2387,17 +2394,24 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + name: "x_1" - name: dropIndex object: *collection arguments: name: "x_1" - - expectError: - isClientError: false - isTimeoutError: false expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -2484,4 +2498,4 @@ tests: command: dropIndexes: *collectionName maxTimeMS: { $$exists: false } - \ No newline at end of file + diff --git a/source/client-side-operations-timeout/tests/override-operation-timeoutMS.json b/source/client-side-operations-timeout/tests/override-operation-timeoutMS.json index 6fa0bd802a..f33f876137 100644 --- a/source/client-side-operations-timeout/tests/override-operation-timeoutMS.json +++ b/source/client-side-operations-timeout/tests/override-operation-timeoutMS.json @@ -3378,15 +3378,23 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "timeoutMS": 1000, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "timeoutMS": 1000, "name": "x_1" - }, - "expectError": { - "isTimeoutError": false } } ], @@ -3394,6 +3402,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", @@ -3436,15 +3450,23 @@ } } }, + { + "name": "createIndex", + "object": "collection", + "arguments": { + "keys": { + "x": 1 + }, + "timeoutMS": 0, + "name": "x_1" + } + }, { "name": "dropIndex", "object": "collection", "arguments": { "timeoutMS": 0, "name": "x_1" - }, - "expectError": { - "isTimeoutError": false } } ], @@ -3452,6 +3474,12 @@ { "client": "client", "events": [ + { + "commandStartedEvent": { + "commandName": "createIndexes", + "databaseName": "test" + } + }, { "commandStartedEvent": { "commandName": "dropIndexes", diff --git a/source/client-side-operations-timeout/tests/override-operation-timeoutMS.yml b/source/client-side-operations-timeout/tests/override-operation-timeoutMS.yml index 28eabcb7c8..370e9393cf 100644 --- a/source/client-side-operations-timeout/tests/override-operation-timeoutMS.yml +++ b/source/client-side-operations-timeout/tests/override-operation-timeoutMS.yml @@ -1812,17 +1812,26 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + timeoutMS: 1000 + name: "x_1" - name: dropIndex object: *collection arguments: timeoutMS: 1000 name: "x_1" - - expectError: - isTimeoutError: false # IndexNotFound expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -1842,17 +1851,26 @@ tests: failCommands: ["dropIndexes"] blockConnection: true blockTimeMS: 15 + # Create the index first so dropIndex doesn't return IndexNotFound on + # servers prior to 8.3. + - name: createIndex + object: *collection + arguments: + keys: { x: 1 } + timeoutMS: 0 + name: "x_1" - name: dropIndex object: *collection arguments: timeoutMS: 0 name: "x_1" - - expectError: - isTimeoutError: false # IndexNotFound expectEvents: - client: *client events: + - commandStartedEvent: + commandName: createIndexes + databaseName: *databaseName + - commandStartedEvent: commandName: dropIndexes databaseName: *databaseName @@ -1915,4 +1933,4 @@ tests: command: dropIndexes: *collectionName maxTimeMS: { $$exists: false } - \ No newline at end of file +