diff options
Diffstat (limited to 'jstests/replsets/print_secondary_replication_info_unreachable_secondary.js')
-rw-r--r-- | jstests/replsets/print_secondary_replication_info_unreachable_secondary.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/replsets/print_secondary_replication_info_unreachable_secondary.js b/jstests/replsets/print_secondary_replication_info_unreachable_secondary.js new file mode 100644 index 00000000000..4948ac85801 --- /dev/null +++ b/jstests/replsets/print_secondary_replication_info_unreachable_secondary.js @@ -0,0 +1,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(); +})(); |