Skip to content

Commit 1c3f5dd

Browse files
committed
feat(shell-api): add automerge information to sh.status() MONGOSH-1649
1 parent 7e22614 commit 1c3f5dd

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

packages/shell-api/src/helpers.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ describe('getPrintableShardStatus', function () {
224224
);
225225
expect(status['most recently active mongoses']).to.have.lengthOf(1);
226226
expect(status.autosplit['Currently enabled']).to.equal('yes');
227+
expect(status.automerge['Currently enabled']).to.equal('yes');
227228
expect(status.balancer['Currently enabled']).to.equal('yes');
228229
expect(
229230
status.balancer['Failed balancer rounds in last 5 attempts']

packages/shell-api/src/helpers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ export async function getPrintableShardStatus(
327327
autosplit === null || autosplit.enabled ? 'yes' : 'no',
328328
};
329329
})(),
330+
(async (): Promise<void> => {
331+
// Is automerge currently enabled, available since >= 7.0
332+
const automerge = await settingsColl.findOne({ _id: 'automerge' });
333+
result.automerge = {
334+
'Currently enabled':
335+
automerge === null || automerge.enabled ? 'yes' : 'no',
336+
};
337+
})(),
330338
(async (): Promise<void> => {
331339
// Is the balancer currently enabled
332340
const balancerEnabled = await settingsColl.findOne({ _id: 'balancer' });
@@ -713,6 +721,10 @@ export type ShardingStatusResult = {
713721
autosplit: {
714722
'Currently enabled': 'yes' | 'no';
715723
};
724+
/** Available from 7.0.0 */
725+
automerge: {
726+
'Currently enabled': 'yes' | 'no';
727+
};
716728
balancer: {
717729
'Currently enabled': 'yes' | 'no';
718730
'Currently running': 'yes' | 'no' | 'unknown';

packages/shell-api/src/shard.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,6 +2419,7 @@ describe('Shard', function () {
24192419
'shardingVersion',
24202420
'shards',
24212421
'autosplit',
2422+
'automerge',
24222423
'balancer',
24232424
'databases',
24242425
]);
@@ -2463,6 +2464,7 @@ describe('Shard', function () {
24632464
'shardingVersion',
24642465
'shards',
24652466
'autosplit',
2467+
'automerge',
24662468
'balancer',
24672469
'databases',
24682470
]);

0 commit comments

Comments
 (0)