summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2022-03-21 17:17:01 +0000
committerTommaso Tocci <tommaso.tocci@mongodb.com>2022-03-23 15:37:56 +0100
commit5c12495a4e7dbf803ba0dc5064dd3c5b1491f170 (patch)
tree76b3da53351ac6f9a83555a42abd5cbdbab71392 /jstests
parent8e792015718d10e529fcb8d95089e9df2b8c034a (diff)
downloadmongo-5c12495a4e7dbf803ba0dc5064dd3c5b1491f170.tar.gz
SERVER-64651 Prevent refineCollectionShardKey to run on config server
(cherry picked from commit ece9ffb3227b8e69d8908ae0d0437701d9847a77)
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/refine_collection_shard_key_basic.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/jstests/sharding/refine_collection_shard_key_basic.js b/jstests/sharding/refine_collection_shard_key_basic.js
index 46d6e61f0cd..570c0f7f6b7 100644
--- a/jstests/sharding/refine_collection_shard_key_basic.js
+++ b/jstests/sharding/refine_collection_shard_key_basic.js
@@ -274,6 +274,11 @@ assert.commandFailedWithCode(
mongos.adminCommand({refineCollectionShardKey: kNsName, key: {_id: 1, aKey: 1}}),
ErrorCodes.NamespaceNotSharded);
+// Should fail because operation can't run on config server
+assert.commandFailedWithCode(
+ mongos.adminCommand({refineCollectionShardKey: "config.collections", key: {_id: 1, aKey: 1}}),
+ ErrorCodes.NoShardingEnabled);
+
enableShardingAndShardColl({_id: 1});
// Should fail because shard key is invalid (i.e. bad values).