Skip to content

Commit a6dbd20

Browse files
DRIVERS-3261 Remove IndexNotFound error checks for dropIndex (#1827)
Co-authored-by: Bailey Pearson <[email protected]>
1 parent a93fa90 commit a6dbd20

11 files changed

+316
-101
lines changed

source/client-side-operations-timeout/etc/generate-basic-tests.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
# operations. Individual generation functions can choose to include them if needed.
6464
OPERATIONS = CLIENT_OPERATIONS + DB_OPERATIONS + COLLECTION_OPERATIONS
6565

66-
RETRYABLE_WRITE_OPERATIONS = [op for op in OPERATIONS if op.operation_name in
66+
RETRYABLE_WRITE_OPERATIONS = [op for op in OPERATIONS if op.operation_name in
6767
['insertOne', 'updateOne', 'deleteOne', 'replaceOne', 'findOneAndDelete', 'findOneAndUpdate', 'findOneAndReplace', 'insertMany', 'bulkWrite']
6868
]
6969

@@ -102,28 +102,33 @@ def generate(name, operations):
102102
}
103103
write_yaml(name, template, injections)
104104

105-
def generate_global_timeout_tests():
106-
generate('global-timeoutMS', OPERATIONS)
107-
108-
def generate_override_db():
109-
generate('override-database-timeoutMS', DB_OPERATIONS + COLLECTION_OPERATIONS)
110-
111-
def generate_override_coll():
112-
generate('override-collection-timeoutMS', COLLECTION_OPERATIONS)
113-
114-
def generate_override_operation():
115-
generate('override-operation-timeoutMS', OPERATIONS)
105+
# TODO(DRIVERS-3266): Investigate dropping generator script for index-related
106+
# timeoutMS tests
107+
#def generate_global_timeout_tests():
108+
# generate('global-timeoutMS', OPERATIONS)
109+
#
110+
#def generate_override_db():
111+
# generate('override-database-timeoutMS', DB_OPERATIONS + COLLECTION_OPERATIONS)
112+
#
113+
#def generate_override_coll():
114+
# generate('override-collection-timeoutMS', COLLECTION_OPERATIONS)
115+
#
116+
#def generate_override_operation():
117+
# generate('override-operation-timeoutMS', OPERATIONS)
118+
#
119+
#def generate_deprecated():
120+
# generate('deprecated-options', OPERATIONS)
116121

117122
def generate_retryable():
118123
generate('retryability-timeoutMS', RETRYABLE_WRITE_OPERATIONS + RETRYABLE_READ_OPERATIONS)
119124
generate('retryability-legacy-timeouts', RETRYABLE_WRITE_OPERATIONS + RETRYABLE_READ_OPERATIONS)
120125

121-
def generate_deprecated():
122-
generate('deprecated-options', OPERATIONS)
126+
# TODO(DRIVERS-3266): Investigate dropping generator script for index-related
127+
# timeoutMS tests
128+
#generate_global_timeout_tests()
129+
#generate_override_db()
130+
#generate_override_coll()
131+
#generate_override_operation()
132+
#generate_deprecated()
123133

124-
generate_global_timeout_tests()
125-
generate_override_db()
126-
generate_override_coll()
127-
generate_override_operation()
128134
generate_retryable()
129-
generate_deprecated()

source/client-side-operations-timeout/tests/deprecated-options.json

Lines changed: 55 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/deprecated-options.yml

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,16 +3743,19 @@ tests:
37433743
failCommands: ["dropIndexes"]
37443744
blockConnection: true
37453745
blockTimeMS: 5
3746+
# Create the index first so dropIndex doesn't return IndexNotFound on
3747+
# servers prior to 8.3.
3748+
- name: createIndex
3749+
object: *collection
3750+
arguments:
3751+
keys: { x: 1 }
3752+
timeoutMS: 100000
3753+
name: "x_1"
37463754
- name: dropIndex
37473755
object: *collection
37483756
arguments:
37493757
timeoutMS: 100000
37503758
name: "x_1"
3751-
3752-
expectError:
3753-
isClientError: false
3754-
isTimeoutError: false
3755-
37563759
- description: "wTimeoutMS is ignored if timeoutMS is set - dropIndex on collection"
37573760
operations:
37583761
- name: createEntities
@@ -3781,18 +3784,26 @@ tests:
37813784
- session:
37823785
id: &session session
37833786
client: *client
3787+
# Create the index first so dropIndex doesn't return IndexNotFound on
3788+
# servers prior to 8.3.
3789+
- name: createIndex
3790+
object: *collection
3791+
arguments:
3792+
keys: { x: 1 }
3793+
timeoutMS: 100000
3794+
name: "x_1"
37843795
- name: dropIndex
37853796
object: *collection
37863797
arguments:
37873798
timeoutMS: 100000
37883799
name: "x_1"
3789-
3790-
expectError:
3791-
isClientError: false
3792-
isTimeoutError: false
37933800
expectEvents:
37943801
- client: *client
37953802
events:
3803+
- commandStartedEvent:
3804+
commandName: createIndexes
3805+
databaseName: *databaseName
3806+
37963807
- commandStartedEvent:
37973808
commandName: dropIndexes
37983809
databaseName: *databaseName
@@ -3828,19 +3839,26 @@ tests:
38283839
- session:
38293840
id: &session session
38303841
client: *client
3842+
# Create the index first so dropIndex doesn't return IndexNotFound on
3843+
# servers prior to 8.3.
3844+
- name: createIndex
3845+
object: *collection
3846+
arguments:
3847+
keys: { x: 1 }
3848+
name: "x_1"
38313849
- name: dropIndex
38323850
object: *collection
38333851
arguments:
38343852
timeoutMS: &timeoutMS 1000
38353853
maxTimeMS: 5000
38363854
name: "x_1"
3837-
3838-
expectError:
3839-
isClientError: false
3840-
isTimeoutError: false
38413855
expectEvents:
38423856
- client: *client
38433857
events:
3858+
- commandStartedEvent:
3859+
commandName: createIndexes
3860+
databaseName: *databaseName
3861+
38443862
- commandStartedEvent:
38453863
commandName: dropIndexes
38463864
databaseName: *databaseName
@@ -3884,6 +3902,14 @@ tests:
38843902
failCommands: ["dropIndexes"]
38853903
blockConnection: true
38863904
blockTimeMS: 5
3905+
# Create the index first so dropIndex doesn't return IndexNotFound on
3906+
# servers prior to 8.3.
3907+
- name: createIndex
3908+
object: *collection
3909+
arguments:
3910+
keys: { x: 1 }
3911+
name: "x_1"
3912+
timeoutMS: 100000
38873913
- name: dropIndexes
38883914
object: *collection
38893915
arguments:
@@ -3979,4 +4005,4 @@ tests:
39794005
command:
39804006
dropIndexes: *collectionName
39814007
maxTimeMS: { $$lte: *timeoutMS }
3982-
4008+

source/client-side-operations-timeout/tests/global-timeoutMS.json

Lines changed: 16 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-operations-timeout/tests/global-timeoutMS.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3120,17 +3120,24 @@ tests:
31203120
failCommands: ["dropIndexes"]
31213121
blockConnection: true
31223122
blockTimeMS: 15
3123+
# Create the index first so dropIndex doesn't return IndexNotFound on
3124+
# servers prior to 8.3.
3125+
- name: createIndex
3126+
object: *collection
3127+
arguments:
3128+
keys: { x: 1 }
3129+
name: "x_1"
31233130
- name: dropIndex
31243131
object: *collection
31253132
arguments:
31263133
name: "x_1"
3127-
3128-
expectError:
3129-
isClientError: false
3130-
isTimeoutError: false
31313134
expectEvents:
31323135
- client: *client
31333136
events:
3137+
- commandStartedEvent:
3138+
commandName: createIndexes
3139+
databaseName: *databaseName
3140+
31343141
- commandStartedEvent:
31353142
commandName: dropIndexes
31363143
databaseName: *databaseName
@@ -3233,4 +3240,4 @@ tests:
32333240
command:
32343241
dropIndexes: *collectionName
32353242
maxTimeMS: { $$exists: false }
3236-
3243+

0 commit comments

Comments
 (0)