Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions source/client-side-operations-timeout/etc/generate-basic-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
]

Expand Down Expand Up @@ -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()

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -3979,4 +4005,4 @@ tests:
command:
dropIndexes: *collectionName
maxTimeMS: { $$lte: *timeoutMS }


Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -3233,4 +3240,4 @@ tests:
command:
dropIndexes: *collectionName
maxTimeMS: { $$exists: false }


Loading
Loading