summaryrefslogtreecommitdiff
path: root/jstests/sharding/index_commands_shard_targeting.js
diff options
context:
space:
mode:
authorArun Banala <arun.banala@mongodb.com>2021-11-29 12:59:18 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-03 20:05:44 +0000
commit3242083daae059800badc55b6c4e050454fa6c70 (patch)
treeafaeea07469711ed8a667043896146692628d335 /jstests/sharding/index_commands_shard_targeting.js
parent6ef5da0c8cdce8a4398ad00ede82ffa674f4e62c (diff)
downloadmongo-3242083daae059800badc55b6c4e050454fa6c70.tar.gz
Revert "SERVER-60694 Move collMod to DDL coordinator infrastructure"
Diffstat (limited to 'jstests/sharding/index_commands_shard_targeting.js')
-rw-r--r--jstests/sharding/index_commands_shard_targeting.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/jstests/sharding/index_commands_shard_targeting.js b/jstests/sharding/index_commands_shard_targeting.js
index c9f70fc8f50..d7a5f0d0c86 100644
--- a/jstests/sharding/index_commands_shard_targeting.js
+++ b/jstests/sharding/index_commands_shard_targeting.js
@@ -55,8 +55,7 @@ function assertCommandChecksShardVersions(st, dbName, collName, testCase) {
// (no chunks).
ShardVersioningUtil.assertCollectionVersionOlderThan(st.shard0, ns, latestCollectionVersion);
- // Assert that the targeted shards have the latest collection version after the command is
- // run.
+ // Assert that the targeted shards have the latest collection version after the command is run.
ShardVersioningUtil.assertCollectionVersionEquals(st.shard1, ns, latestCollectionVersion);
ShardVersioningUtil.assertCollectionVersionEquals(st.shard2, ns, latestCollectionVersion);
}
@@ -181,6 +180,19 @@ const testCases = {
}
};
},
+ collMod: collName => {
+ return {
+ command: {collMod: collName, validator: {x: {$type: "string"}}},
+ assertCommandRanOnShard: (shard) => {
+ assert.commandFailedWithCode(
+ shard.getCollection(dbName + "." + collName).insert({x: 1}),
+ ErrorCodes.DocumentValidationFailure);
+ },
+ assertCommandDidNotRunOnShard: (shard) => {
+ assert.commandWorked(shard.getCollection(dbName + "." + collName).insert({x: 1}));
+ }
+ };
+ },
};
assert.commandWorked(st.s.adminCommand({enableSharding: dbName}));