summaryrefslogtreecommitdiff
path: root/jstests/serverless/shard_split_basic_test.js
blob: c5bb56f2d7ec1e53e80041437e0be62057c1af7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Tests that runs a shard split to completion.
 * @tags: [requires_fcv_62, serverless]
 */

load("jstests/serverless/libs/shard_split_test.js");

(function() {
"use strict";

const tenantIds = [ObjectId(), ObjectId()];
const test = new ShardSplitTest({quickGarbageCollection: true});
test.addRecipientNodes();
test.donor.awaitSecondaryNodes();

const donorPrimary = test.getDonorPrimary();
const operation = test.createSplitOperation(tenantIds);
assert.commandWorked(operation.commit());
assertMigrationState(donorPrimary, operation.migrationId, "committed");
operation.forget();

const status = donorPrimary.adminCommand({serverStatus: 1});
assert.eq(status.shardSplits.totalCommitted, 1);
assert.eq(status.shardSplits.totalAborted, 0);
assert.gt(status.shardSplits.totalCommittedDurationMillis, 0);
assert.gt(status.shardSplits.totalCommittedDurationWithoutCatchupMillis, 0);

test.cleanupSuccesfulCommitted(operation.migrationId, tenantIds);
test.stop();
})();