summaryrefslogtreecommitdiff
path: root/jstests/replsets/print_secondary_replication_info_unreachable_secondary.js
blob: 4948ac8580197436be457822ac16f442a862f4b8 (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
// Tests the output of db.printSecondaryReplicationInfo() for unreachable secondaries.

(function() {
"use strict";
const name = "printSecondaryReplicationInfo";
const replSet = new ReplSetTest({name: name, nodes: 2});
replSet.startSet();
replSet.initiateWithHighElectionTimeout();

const primary = replSet.getPrimary();
primary.getDB('test').foo.insert({a: 1});
replSet.awaitReplication();

const secondary = replSet.getSecondary();
replSet.stop(replSet.getNodeId(secondary));
replSet.waitForState(secondary, ReplSetTest.State.DOWN);

const joinShell =
    startParallelShell("db.getSiblingDB('admin').printSecondaryReplicationInfo();", primary.port);
joinShell();
assert(
    rawMongoProgramOutput().match("no replication info, yet.  State: \\(not reachable/healthy\\)"));

replSet.stopSet();
})();