summaryrefslogtreecommitdiff
path: root/jstests/sharding/reshard_collection_resharding_improvements_basic.js
diff options
context:
space:
mode:
authorJiawei Yang <jiawei.yang@mongodb.com>2023-05-17 20:22:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-17 21:20:13 +0000
commit41c95363ac628dd0a89fb18c369b0fdef42496e2 (patch)
tree631170997cc0331f6e70c47f3cfddb5da8a55f37 /jstests/sharding/reshard_collection_resharding_improvements_basic.js
parenteee02283872da4cfb30e362b09472559d53c87d0 (diff)
downloadmongo-41c95363ac628dd0a89fb18c369b0fdef42496e2.tar.gz
SERVER-77202 create ReshardCollectionCmdTest util
Diffstat (limited to 'jstests/sharding/reshard_collection_resharding_improvements_basic.js')
-rw-r--r--jstests/sharding/reshard_collection_resharding_improvements_basic.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/jstests/sharding/reshard_collection_resharding_improvements_basic.js b/jstests/sharding/reshard_collection_resharding_improvements_basic.js
index 3244a3cac0d..9339ef9bddb 100644
--- a/jstests/sharding/reshard_collection_resharding_improvements_basic.js
+++ b/jstests/sharding/reshard_collection_resharding_improvements_basic.js
@@ -11,12 +11,16 @@
'use strict';
load("jstests/libs/feature_flag_util.js");
+load("jstests/sharding/libs/reshard_collection_util.js");
const st = new ShardingTest({mongos: 1, shards: 2});
const kDbName = 'db';
const collName = 'foo';
const ns = kDbName + '.' + collName;
const mongos = st.s0;
+const kNumInitialDocs = 500;
+const reshardCmdTest =
+ new ReshardCollectionCmdTest({st, dbName: kDbName, collName, numInitialDocs: kNumInitialDocs});
const testShardDistribution = (mongos) => {
if (!FeatureFlagUtil.isEnabled(mongos, "ReshardingImprovements")) {
@@ -105,14 +109,20 @@ const testShardDistribution = (mongos) => {
shardDistribution: [{shard: st.shard0.shardName}, {shard: st.shard1.shardName}]
}),
ErrorCodes.InvalidOptions);
- assert.commandWorked(mongos.adminCommand({
- reshardCollection: ns,
- key: {newKey: 1},
- shardDistribution: [
- {shard: st.shard0.shardName, min: {newKey: MinKey}, max: {newKey: 0}},
- {shard: st.shard1.shardName, min: {newKey: 0}, max: {newKey: MaxKey}}
- ]
- }));
+ reshardCmdTest.assertReshardCollOk(
+ {
+ reshardCollection: ns,
+ key: {newKey: 1},
+ shardDistribution: [
+ {shard: st.shard0.shardName, min: {newKey: MinKey}, max: {newKey: 0}},
+ {shard: st.shard1.shardName, min: {newKey: 0}, max: {newKey: MaxKey}}
+ ]
+ },
+ 2,
+ [
+ {recipientShardId: st.shard0.shardName, min: {newKey: MinKey}, max: {newKey: 0}},
+ {recipientShardId: st.shard1.shardName, min: {newKey: 0}, max: {newKey: MaxKey}}
+ ]);
};
testShardDistribution(mongos);