diff options
author | Will Banfield <william.banfield@10gen.com> | 2017-08-03 14:31:53 -0400 |
---|---|---|
committer | Will Banfield <william.banfield@10gen.com> | 2017-10-04 17:48:33 -0400 |
commit | 232f7986c623dd92e39ea9477149f2655f01bf4c (patch) | |
tree | d0e52d53b80829a55d82b2d73dc425c0e63a72a6 /jstests/tool/tool_replset.js | |
parent | 5180b8e6272169f1f8f237f1d64fe57f690b4802 (diff) | |
download | mongo-232f7986c623dd92e39ea9477149f2655f01bf4c.tar.gz |
TOOLS-1764 fix tool_replset.js
Diffstat (limited to 'jstests/tool/tool_replset.js')
-rw-r--r-- | jstests/tool/tool_replset.js | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/jstests/tool/tool_replset.js b/jstests/tool/tool_replset.js index 7829e46f042..13c2040c912 100644 --- a/jstests/tool/tool_replset.js +++ b/jstests/tool/tool_replset.js @@ -17,7 +17,7 @@ (function() { "use strict"; - var replTest = new ReplSetTest({name: 'tool_replset', nodes: 2, oplogSize: 5}); + var replTest = new ReplSetTest({name: 'tool_replset', nodes: 2, oplogSize: 5, nodeOptions: {"vvvvv":""}}); var nodes = replTest.startSet(); var config = replTest.getReplSetConfig(); config.members[0].priority = 3; @@ -25,8 +25,7 @@ replTest.initiate(config); var master = replTest.getPrimary(); assert.eq(nodes[0], master, "incorrect master elected"); - for (var i = 0; i < 100; i++) { - assert.writeOK(master.getDB("foo").bar.insert({a: i})); + for (var i = 0; i < 100; i++) { assert.writeOK(master.getDB("foo").bar.insert({a: i})); } replTest.awaitReplication(); @@ -88,6 +87,9 @@ var x = master.getDB("foo").getCollection("bar").count(); assert.eq(x, 100, "mongoimport should have successfully imported the collection"); + + + var doc = {_id: 5, x: 17}; var oplogEntry = {ts: new Timestamp(), "op": "i", "ns": "foo.bar", "o": doc, "v": NumberInt(2)}; assert.writeOK(master.getDB("local").oplog.rs.insert(oplogEntry)); @@ -104,9 +106,18 @@ print("finished running mongooplog to replay the oplog"); - assert.eq(101, - master.getDB("foo").getCollection("bar").count(), - "count after running " + "mongooplog was not 101 as expected"); + var foundDocs = master.getDB("foo").getCollection("bar").find({_id: 5}).toArray() + assert.eq(foundDocs.length, 1, "mongooplog expected to have inserted one document") + assert.docEq(foundDocs[0], doc, "document inserted by mongooplog expected to match") + /* + assert.soon(function() { + var numDocs = master.getDB("foo").getCollection("bar").count(); + if (numDocs == 101) { + return true; + } + return false; + }, "count after running " + "mongooplog was not 101 as expected"); +*/ print("all tests successful, stopping replica set"); |