summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2017-05-05 16:20:35 -0400
committerBenety Goh <benety@mongodb.com>2017-06-13 22:22:14 -0400
commit36f59e7d69ff1742ecaa4b71296bc553d5650b6d (patch)
tree7e44ecdc284ae79ffbd37eb7508bd2694462d50c /src/mongo
parent76a7e10984d940afb419acdbd2cff14acae0c271 (diff)
downloadmongo-36f59e7d69ff1742ecaa4b71296bc553d5650b6d.tar.gz
SERVER-28100 ReplSetTest.awaitNodesAgreeOnPrimary() accepts an optional expectedPrimaryIndex
(cherry-picked from commit 8d146d21661cf755fc15b7eefec147ce85ffde8c)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/shell/replsettest.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 59681b90f8c..667cef8c430 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -525,13 +525,17 @@ var ReplSetTest = function(opts) {
/**
* Blocks until all nodes agree on who the primary is.
+ * If 'expectedPrimaryNodeId' is provided, ensure that every node is seeing this node as the
+ * primary. Otherwise, ensure that all the nodes in the set agree with the first node on the
+ * identity of the primary.
*/
- this.awaitNodesAgreeOnPrimary = function(timeout, nodes) {
+ this.awaitNodesAgreeOnPrimary = function(timeout, nodes, expectedPrimaryNodeId) {
timeout = timeout || self.kDefaultTimeoutMS;
nodes = nodes || self.nodes;
+ expectedPrimaryNodeId = expectedPrimaryNodeId || -1;
assert.soonNoExcept(function() {
- var primary = -1;
+ var primary = expectedPrimaryNodeId;
for (var i = 0; i < nodes.length; i++) {
var replSetGetStatus = nodes[i].getDB("admin").runCommand({replSetGetStatus: 1});