summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Pasette <dan@10gen.com>2013-06-26 14:15:42 -0400
committerDan Pasette <dan@10gen.com>2013-06-26 14:15:42 -0400
commitbd0713e9a67f67b19944841275007f6fc6ee1c69 (patch)
treedf911c072df02f47eb796f289bac575cd93a7531
parente14606de365ef11a49ba5c0cf63f5418eee8ad55 (diff)
downloadmongo-bd0713e9a67f67b19944841275007f6fc6ee1c69.tar.gz
SERVER-9005 synchronizing replication to fix racy test
-rw-r--r--jstests/replsets/get_last_error.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/jstests/replsets/get_last_error.js b/jstests/replsets/get_last_error.js
index 9d1958a400e..8a31a0fe7a2 100644
--- a/jstests/replsets/get_last_error.js
+++ b/jstests/replsets/get_last_error.js
@@ -5,8 +5,13 @@ var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var mdb = master.getDB("test");
+
+// synchronize replication
mdb.foo.insert({ _id: "1" });
+replTest.awaitReplication();
+// do a second write to do gle tests on
+mdb.foo.insert({ _id: "2" });
var gle = master.getDB("test").runCommand({getLastError : 1, j : true, wtimeout : 60000});
print('Trying j=true, 60000ms timeout');
@@ -26,8 +31,6 @@ assert.eq(gle.wtime, null);
assert.eq(gle.waited, null);
assert.eq(gle.wtimeout, null);
-// Await replication to ensure this will succeed
-replTest.awaitReplication();
gle = mdb.getLastErrorObj(2, 500);
print('Trying w=2, 500ms timeout.');
printjson(gle);