diff options
Diffstat (limited to 'jstests/sharding/resharding_prohibited_commands.js')
-rw-r--r-- | jstests/sharding/resharding_prohibited_commands.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/jstests/sharding/resharding_prohibited_commands.js b/jstests/sharding/resharding_prohibited_commands.js index 6cbaf338ca5..6d49babf98f 100644 --- a/jstests/sharding/resharding_prohibited_commands.js +++ b/jstests/sharding/resharding_prohibited_commands.js @@ -33,7 +33,9 @@ const indexDroppedByTest = { }; const prohibitedCommands = [ - {collMod: collectionName}, + // The collMod is serialized with the resharding command, so we explicitly add an timeout to the + // command so that it doesn't get blocked and timeout the test. + {collMod: collectionName, maxTimeMS: 5000}, {createIndexes: collectionName, indexes: [{name: "idx1", key: indexCreatedByTest}]}, {dropIndexes: collectionName, index: indexDroppedByTest}, ]; @@ -63,8 +65,9 @@ const assertCommandsSucceedAfterReshardingOpFinishes = (database) => { const assertCommandsFailDuringReshardingOp = (database) => { prohibitedCommands.forEach((command) => { jsTest.log(`Testing that ${tojson(command)} fails during resharding operation`); - assert.commandFailedWithCode(database.runCommand(command), - ErrorCodes.ReshardCollectionInProgress); + assert.commandFailedWithCode( + database.runCommand(command), + [ErrorCodes.ReshardCollectionInProgress, ErrorCodes.MaxTimeMSExpired]); }); }; |