summaryrefslogtreecommitdiff
path: root/jstests/replsets/sync2.js
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2014-08-25 06:24:43 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2014-08-25 09:26:27 -0400
commit7cc768b403b9bec0c26afe9ad3c56034b6638961 (patch)
tree44e24e24ce2bfb6a20ed0cb984764a79908e8f76 /jstests/replsets/sync2.js
parent15a025f43ff3b038c17fce40b7d0802a58ab4e3b (diff)
downloadmongo-7cc768b403b9bec0c26afe9ad3c56034b6638961.tar.gz
SERVER-15028 prevent sync2.js from attempting an insert on an incorrect primary node
Diffstat (limited to 'jstests/replsets/sync2.js')
-rw-r--r--jstests/replsets/sync2.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/jstests/replsets/sync2.js b/jstests/replsets/sync2.js
index 5969663681a..9cd3cf61de2 100644
--- a/jstests/replsets/sync2.js
+++ b/jstests/replsets/sync2.js
@@ -1,6 +1,6 @@
var replTest = new ReplSetTest({name: 'sync2', nodes: 5});
var nodes = replTest.nodeList();
-replTest.startSet({oplogSize: "2"});
+var conns = replTest.startSet({oplogSize: "2"});
replTest.initiate({"_id": "sync2",
"members": [
{"_id": 0, host: nodes[0], priority: 2},
@@ -29,6 +29,11 @@ replTest.partition(3,1);
replTest.partition(4,1);
replTest.partition(4,3);
+assert.soon(function() {
+ master = replTest.getMaster();
+ return master === conns[0];
+}, 60 * 1000, "node 0 did not become primary quickly enough");
+
jsTestLog("Checking that ops still replicate correctly");
var option = { writeConcern: { w: 5, wtimeout: 30000 }};
assert.writeOK(master.getDB("foo").bar.insert({ x: 1 }, option));