diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-04-23 17:13:51 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2018-05-01 09:43:36 -0400 |
commit | 80ae7e58d34c827f9e0fe0ea9341680f6a1abb74 (patch) | |
tree | 0fa704f691cecae51fb391a7e78cf470bea02316 /jstests/replsets | |
parent | 3ccb539d044a66bb0f7e341048882b51171e8e52 (diff) | |
download | mongo-80ae7e58d34c827f9e0fe0ea9341680f6a1abb74.tar.gz |
SERVER-34526 Jstests should not depend on ReplSetTest.liveNodes
Diffstat (limited to 'jstests/replsets')
36 files changed, 57 insertions, 64 deletions
diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js index 211beb9016e..f784c366cb4 100644 --- a/jstests/replsets/auth1.js +++ b/jstests/replsets/auth1.js @@ -72,7 +72,7 @@ load("jstests/replsets/rslib.js"); var master = rs.getPrimary(); rs.awaitSecondaryNodes(); var mId = rs.getNodeId(master); - var slave = rs.liveNodes.slaves[0]; + var slave = rs._slaves[0]; assert.eq(1, master.getDB("admin").auth("foo", "bar")); assert.writeOK(master.getDB("test").foo.insert( {x: 1}, {writeConcern: {w: 3, wtimeout: ReplSetTest.kDefaultTimeoutMS}})); diff --git a/jstests/replsets/buildindexes.js b/jstests/replsets/buildindexes.js index 1cd6dd1b272..303ed1f352b 100644 --- a/jstests/replsets/buildindexes.js +++ b/jstests/replsets/buildindexes.js @@ -18,7 +18,7 @@ replTest.initiate(config); var master = replTest.getPrimary().getDB(name); - var slaveConns = replTest.liveNodes.slaves; + var slaveConns = replTest._slaves; var slave = []; for (var i in slaveConns) { slaveConns[i].setSlaveOk(); diff --git a/jstests/replsets/capped_insert_order.js b/jstests/replsets/capped_insert_order.js index 037da74c2b6..835c707f9fa 100644 --- a/jstests/replsets/capped_insert_order.js +++ b/jstests/replsets/capped_insert_order.js @@ -9,7 +9,7 @@ replTest.initiate(); var master = replTest.getPrimary(); - var slave = replTest.liveNodes.slaves[0]; + var slave = replTest._slaves[0]; var dbName = "db"; var masterDb = master.getDB(dbName); diff --git a/jstests/replsets/chaining_removal.js b/jstests/replsets/chaining_removal.js index 290a17076e9..111a12887df 100644 --- a/jstests/replsets/chaining_removal.js +++ b/jstests/replsets/chaining_removal.js @@ -64,7 +64,8 @@ // ensure writing to all four nodes still works primary = replTest.getPrimary(); - replTest.awaitReplication(); + const liveSlaves = [nodes[1], nodes[2], nodes[3]]; + replTest.awaitReplication(null, null, liveSlaves); options.writeConcern.w = 4; assert.writeOK(primary.getDB(name).foo.insert({x: 2}, options)); diff --git a/jstests/replsets/cloneDb.js b/jstests/replsets/cloneDb.js index c920a6ab28f..f4ed71bb972 100644 --- a/jstests/replsets/cloneDb.js +++ b/jstests/replsets/cloneDb.js @@ -23,7 +23,7 @@ replTest.startSet(); replTest.initiate(); var master = replTest.getPrimary(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; var masterDB = master.getDB(replsetDBName); masterDB.dropDatabase(); diff --git a/jstests/replsets/copydb.js b/jstests/replsets/copydb.js index e63f6e4b393..2c11e553618 100644 --- a/jstests/replsets/copydb.js +++ b/jstests/replsets/copydb.js @@ -9,7 +9,7 @@ replTest.startSet(); replTest.initiate(); var primary = replTest.getPrimary(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; var sourceDBName = 'copydb-repl-test-source'; var targetDBName = 'copydb-repl-test-target'; diff --git a/jstests/replsets/fsync_lock_read_secondaries.js b/jstests/replsets/fsync_lock_read_secondaries.js index 8a4a49b375c..1f86f420559 100644 --- a/jstests/replsets/fsync_lock_read_secondaries.js +++ b/jstests/replsets/fsync_lock_read_secondaries.js @@ -48,9 +48,8 @@ waitForAllMembers(master.getDB("foo")); replTest.awaitReplication(); - // Calling getPrimary also makes available the liveNodes structure, which looks like this: - // liveNodes = {master: masterNode, slaves: [slave1, slave2] } - var slaves = replTest.liveNodes.slaves; + // Calling getPrimary also populates '_slaves'. + var slaves = replTest._slaves; slaves[0].setSlaveOk(); assert.commandWorked(slaves[0].getDB("admin").runCommand({fsync: 1, lock: 1})); diff --git a/jstests/replsets/get_replication_info_helper.js b/jstests/replsets/get_replication_info_helper.js index 60571e92a96..0fed84db2c4 100644 --- a/jstests/replsets/get_replication_info_helper.js +++ b/jstests/replsets/get_replication_info_helper.js @@ -34,8 +34,8 @@ assert(rawMongoProgramOutput().match("behind the primary")); // get to a primaryless state - for (i in replSet.liveNodes.slaves) { - var secondary = replSet.liveNodes.slaves[i]; + for (i in replSet._slaves) { + var secondary = replSet._slaves[i]; secondary.getDB('admin').runCommand({replSetFreeze: 120}); } try { diff --git a/jstests/replsets/groupAndMapReduce.js b/jstests/replsets/groupAndMapReduce.js index ad2864e08d1..10f15d6f538 100644 --- a/jstests/replsets/groupAndMapReduce.js +++ b/jstests/replsets/groupAndMapReduce.js @@ -33,7 +33,7 @@ doTest = function(signal) { // and slaves in the set and wait until the change has replicated. replTest.awaitReplication(); - slaves = replTest.liveNodes.slaves; + slaves = replTest._slaves; assert(slaves.length == 2, "Expected 2 slaves but length was " + slaves.length); slaves.forEach(function(slave) { // try to read from slave diff --git a/jstests/replsets/initial_sync1.js b/jstests/replsets/initial_sync1.js index cf876a7f1b2..92ace5d0252 100644 --- a/jstests/replsets/initial_sync1.js +++ b/jstests/replsets/initial_sync1.js @@ -30,7 +30,7 @@ var master = replTest.getPrimary(); var foo = master.getDB("foo"); var admin = master.getDB("admin"); -var slave1 = replTest.liveNodes.slaves[0]; +var slave1 = replTest._slaves[0]; var admin_s1 = slave1.getDB("admin"); var local_s1 = slave1.getDB("local"); diff --git a/jstests/replsets/initial_sync2.js b/jstests/replsets/initial_sync2.js index b70dd71bb8f..b08f9bd1a71 100644 --- a/jstests/replsets/initial_sync2.js +++ b/jstests/replsets/initial_sync2.js @@ -31,7 +31,7 @@ var doTest = function() { var foo = master.getDB("foo"); var admin = master.getDB("admin"); - var slave1 = replTest.liveNodes.slaves[0]; + var slave1 = replTest._slaves[0]; var admin_s1 = slave1.getDB("admin"); var local_s1 = slave1.getDB("local"); diff --git a/jstests/replsets/ismaster1.js b/jstests/replsets/ismaster1.js index cfb50a12912..2c9a67d4856 100644 --- a/jstests/replsets/ismaster1.js +++ b/jstests/replsets/ismaster1.js @@ -140,7 +140,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[0], + conn: replTest._slaves[0], name: "slave", goodValues: { setName: "ismaster", @@ -156,7 +156,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[1], + conn: replTest._slaves[1], name: "delayed_slave", goodValues: { setName: "ismaster", @@ -174,7 +174,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[2], + conn: replTest._slaves[2], name: "arbiter", goodValues: { setName: "ismaster", @@ -233,7 +233,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[0], + conn: replTest._slaves[0], name: "first_slave", goodValues: { setName: "ismaster", @@ -250,7 +250,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[1], + conn: replTest._slaves[1], name: "very_delayed_slave", goodValues: { setName: "ismaster", @@ -269,7 +269,7 @@ checkMember({ }); checkMember({ - conn: replTest.liveNodes.slaves[2], + conn: replTest._slaves[2], name: "arbiter", goodValues: { setName: "ismaster", diff --git a/jstests/replsets/maintenance2.js b/jstests/replsets/maintenance2.js index c5e6d9c07e6..b2a1dbec38c 100644 --- a/jstests/replsets/maintenance2.js +++ b/jstests/replsets/maintenance2.js @@ -29,7 +29,7 @@ // and slaves in the set and wait until the change has replicated. // replTest.awaitReplication(); - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; assert.eq(2, slaves.length, "Expected 2 slaves but length was " + slaves.length); slaves.forEach(function(slave) { diff --git a/jstests/replsets/maxSyncSourceLagSecs.js b/jstests/replsets/maxSyncSourceLagSecs.js index 3e0dc7bd3b1..3663972d1fa 100644 --- a/jstests/replsets/maxSyncSourceLagSecs.js +++ b/jstests/replsets/maxSyncSourceLagSecs.js @@ -22,7 +22,7 @@ replTest.awaitNodesAgreeOnPrimary(); var master = replTest.getPrimary(); - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; syncFrom(slaves[0], master, replTest); syncFrom(slaves[1], master, replTest); master.getDB("foo").bar.save({a: 1}); diff --git a/jstests/replsets/pipelineout.js b/jstests/replsets/pipelineout.js index f6a32290001..4a224af5ac8 100644 --- a/jstests/replsets/pipelineout.js +++ b/jstests/replsets/pipelineout.js @@ -8,7 +8,7 @@ replTest.initiate( {"_id": name, "members": [{"_id": 0, "host": nodes[0]}, {"_id": 1, "host": nodes[1]}]}); var primary = replTest.getPrimary().getDB(name); -var secondary = replTest.liveNodes.slaves[0].getDB(name); +var secondary = replTest._slaves[0].getDB(name); // populate the collection for (i = 0; i < 5; i++) { diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js index 438becf98aa..f76ea6488a1 100644 --- a/jstests/replsets/read_committed.js +++ b/jstests/replsets/read_committed.js @@ -74,7 +74,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Get connections and collection. var primary = replTest.getPrimary(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; var coll = primary.getDB(name)[name]; var secondaryColl = secondary.getDB(name)[name]; diff --git a/jstests/replsets/read_committed_after_rollback.js b/jstests/replsets/read_committed_after_rollback.js index 40650bc4011..a4e6ffdacbd 100644 --- a/jstests/replsets/read_committed_after_rollback.js +++ b/jstests/replsets/read_committed_after_rollback.js @@ -64,8 +64,8 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Get connections. var oldPrimary = replTest.getPrimary(); - var newPrimary = replTest.liveNodes.slaves[0]; - var pureSecondary = replTest.liveNodes.slaves[1]; + var newPrimary = replTest._slaves[0]; + var pureSecondary = replTest._slaves[1]; var arbiters = [replTest.nodes[3], replTest.nodes[4]]; // This is the collection that all of the tests will use. diff --git a/jstests/replsets/read_committed_lookup.js b/jstests/replsets/read_committed_lookup.js index fe2a86d8275..fbd4c6f5d19 100644 --- a/jstests/replsets/read_committed_lookup.js +++ b/jstests/replsets/read_committed_lookup.js @@ -38,7 +38,7 @@ load("jstests/libs/read_committed_lib.js"); // For testReadCommittedLookup rst.initiate(config); - let shardSecondary = rst.liveNodes.slaves[0]; + let shardSecondary = rst._slaves[0]; testReadCommittedLookup(rst.getPrimary().getDB("test"), shardSecondary, rst); diff --git a/jstests/replsets/read_committed_no_snapshots.js b/jstests/replsets/read_committed_no_snapshots.js index 83ba451e836..0be3ce4e118 100644 --- a/jstests/replsets/read_committed_no_snapshots.js +++ b/jstests/replsets/read_committed_no_snapshots.js @@ -36,9 +36,9 @@ load("jstests/replsets/rslib.js"); // For reconfig and startSetIfSupportsReadMa // Get connections and collection. var primary = replTest.getPrimary(); - var healthySecondary = replTest.liveNodes.slaves[0]; + var healthySecondary = replTest._slaves[0]; healthySecondary.setSlaveOk(); - var noSnapshotSecondary = replTest.liveNodes.slaves[1]; + var noSnapshotSecondary = replTest._slaves[1]; noSnapshotSecondary.setSlaveOk(); assert.commandWorked(noSnapshotSecondary.adminCommand( {configureFailPoint: 'disableSnapshotting', mode: 'alwaysOn'})); diff --git a/jstests/replsets/read_committed_on_secondary.js b/jstests/replsets/read_committed_on_secondary.js index ec3503a0195..df4394f112f 100644 --- a/jstests/replsets/read_committed_on_secondary.js +++ b/jstests/replsets/read_committed_on_secondary.js @@ -53,7 +53,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Get connections and collection. var primary = replTest.getPrimary(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; var secondaryId = replTest.getNodeId(secondary); var dbPrimary = primary.getDB(name); diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js index e2e75024b8e..95322fd3da5 100644 --- a/jstests/replsets/read_committed_with_catalog_changes.js +++ b/jstests/replsets/read_committed_with_catalog_changes.js @@ -255,7 +255,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. // Get connections. var primary = replTest.getPrimary(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; // This is the DB that all of the tests will use. var mainDB = primary.getDB('mainDB'); diff --git a/jstests/replsets/refresh_sessions_rs.js b/jstests/replsets/refresh_sessions_rs.js index 2083c015515..307915d2faa 100644 --- a/jstests/replsets/refresh_sessions_rs.js +++ b/jstests/replsets/refresh_sessions_rs.js @@ -14,8 +14,8 @@ var primary = replTest.getPrimary(); replTest.awaitSecondaryNodes(); - var server2 = replTest.liveNodes.slaves[0]; - var server3 = replTest.liveNodes.slaves[1]; + var server2 = replTest._slaves[0]; + var server3 = replTest._slaves[1]; var db1 = primary.getDB(dbName); var db2 = server2.getDB(dbName); diff --git a/jstests/replsets/reindex_secondary.js b/jstests/replsets/reindex_secondary.js index 8c812a068ad..388d1f9bf10 100644 --- a/jstests/replsets/reindex_secondary.js +++ b/jstests/replsets/reindex_secondary.js @@ -7,7 +7,7 @@ replTest.initiate(); var master = replTest.getPrimary(); replTest.awaitSecondaryNodes(); -var slaves = replTest.liveNodes.slaves; +var slaves = replTest._slaves; assert(slaves.length == 1, "Expected 1 slave but length was " + slaves.length); slave = slaves[0]; diff --git a/jstests/replsets/replset1.js b/jstests/replsets/replset1.js index 2b00431b79a..05aee648f21 100644 --- a/jstests/replsets/replset1.js +++ b/jstests/replsets/replset1.js @@ -32,13 +32,6 @@ var doTest = function(signal) { // Ensure the primary logs an n-op to the oplog upon transitioning to primary. assert.gt(master.getDB("local").oplog.rs.count({op: 'n', o: {msg: 'new primary'}}), 0); - // Calling getPrimary also makes available the liveNodes structure, - // which looks like this: - // liveNodes = {master: masterNode, - // slaves: [slave1, slave2] - // } - printjson(replTest.liveNodes); - // Here's how you save something to master master.getDB("foo").foo.save({a: 1000}); @@ -102,7 +95,7 @@ var doTest = function(signal) { replTest.awaitSecondaryNodes(); replTest.awaitReplication(); - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; assert(slaves.length == 2, "Expected 2 slaves but length was " + slaves.length); slaves.forEach(function(slave) { slave.setSlaveOk(); @@ -113,8 +106,7 @@ var doTest = function(signal) { // last error master = replTest.getPrimary(); - slaves = replTest.liveNodes.slaves; - printjson(replTest.liveNodes); + slaves = replTest._slaves; var db = master.getDB("foo"); var t = db.foo; diff --git a/jstests/replsets/replset2.js b/jstests/replsets/replset2.js index c79da20be99..b6013c377c6 100644 --- a/jstests/replsets/replset2.js +++ b/jstests/replsets/replset2.js @@ -28,7 +28,7 @@ doTest = function(signal) { // Wait for states to become PRI,SEC,SEC waitForAllMembers(master.getDB(testDB)); - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; slaves.forEach(function(slave) { slave.setSlaveOk(); }); diff --git a/jstests/replsets/replset3.js b/jstests/replsets/replset3.js index 23765afcee6..7f6f9505cc3 100644 --- a/jstests/replsets/replset3.js +++ b/jstests/replsets/replset3.js @@ -52,7 +52,7 @@ var doTest = function(signal) { print(phase++); - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; assert.soon(function() { try { var res = slaves[0].getDB("admin").runCommand({replSetGetStatus: 1}); diff --git a/jstests/replsets/replset4.js b/jstests/replsets/replset4.js index e6df067d1ea..1d5920f1b9e 100644 --- a/jstests/replsets/replset4.js +++ b/jstests/replsets/replset4.js @@ -9,7 +9,7 @@ doTest = function(signal) { var master = replTest.getPrimary(); // Kill both slaves, simulating a network partition - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; for (var i = 0; i < slaves.length; i++) { var slave_id = replTest.getNodeId(slaves[i]); replTest.stop(slave_id); diff --git a/jstests/replsets/replset5.js b/jstests/replsets/replset5.js index 9d157d580c7..29ffc152c95 100644 --- a/jstests/replsets/replset5.js +++ b/jstests/replsets/replset5.js @@ -50,7 +50,7 @@ load("jstests/replsets/rslib.js"); return; } - var slaves = replTest.liveNodes.slaves; + var slaves = replTest._slaves; slaves[0].setSlaveOk(); slaves[1].setSlaveOk(); diff --git a/jstests/replsets/replset6.js b/jstests/replsets/replset6.js index c0419f3c4db..63e9509e2b7 100644 --- a/jstests/replsets/replset6.js +++ b/jstests/replsets/replset6.js @@ -8,7 +8,7 @@ var nodes = rt.startSet(); rt.initiate(); var m = rt.getPrimary(); rt.awaitSecondaryNodes(); -var slaves = rt.liveNodes.slaves; +var slaves = rt._slaves; s = slaves[0]; s.setSlaveOk(); admin = m.getDB("admin"); diff --git a/jstests/replsets/replsetrestart1.js b/jstests/replsets/replsetrestart1.js index 388de3e1b71..01ab2c702e4 100644 --- a/jstests/replsets/replsetrestart1.js +++ b/jstests/replsets/replsetrestart1.js @@ -44,9 +44,9 @@ // Now we're going to shut down all nodes var mId = replTest.getNodeId(master); - var s1 = replTest.liveNodes.slaves[0]; + var s1 = replTest._slaves[0]; var s1Id = replTest.getNodeId(s1); - var s2 = replTest.liveNodes.slaves[1]; + var s2 = replTest._slaves[1]; var s2Id = replTest.getNodeId(s2); replTest.stop(s1Id); diff --git a/jstests/replsets/sessions_collection_auto_healing.js b/jstests/replsets/sessions_collection_auto_healing.js index ef396737c2b..e77b99f4059 100644 --- a/jstests/replsets/sessions_collection_auto_healing.js +++ b/jstests/replsets/sessions_collection_auto_healing.js @@ -11,7 +11,7 @@ load('jstests/libs/sessions_collection.js'); var primaryAdmin = primary.getDB("admin"); replTest.awaitSecondaryNodes(); - var secondary = replTest.liveNodes.slaves[0]; + var secondary = replTest._slaves[0]; var secondaryAdmin = secondary.getDB("admin"); // Test that we can use sessions on the primary diff --git a/jstests/replsets/slavedelay1.js b/jstests/replsets/slavedelay1.js index fa47d57462f..4a356eb62da 100644 --- a/jstests/replsets/slavedelay1.js +++ b/jstests/replsets/slavedelay1.js @@ -17,7 +17,7 @@ doTest = function(signal) { replTest.initiate(config); var master = replTest.getPrimary().getDB(name); - var slaveConns = replTest.liveNodes.slaves; + var slaveConns = replTest._slaves; var slaves = []; for (var i in slaveConns) { var d = slaveConns[i].getDB(name); diff --git a/jstests/replsets/slavedelay3.js b/jstests/replsets/slavedelay3.js index f07bccfee47..bd9dc6dcb0d 100644 --- a/jstests/replsets/slavedelay3.js +++ b/jstests/replsets/slavedelay3.js @@ -13,7 +13,7 @@ config.members[2].priority = 0; replTest.initiate(config); var master = replTest.getPrimary().getDB(name); -var slaveConns = replTest.liveNodes.slaves; +var slaveConns = replTest._slaves; var slave = []; for (var i in slaveConns) { var d = slaveConns[i].getDB(name); diff --git a/jstests/replsets/stepdown.js b/jstests/replsets/stepdown.js index 74a4cf3aa4f..52f8aef23a9 100644 --- a/jstests/replsets/stepdown.js +++ b/jstests/replsets/stepdown.js @@ -44,8 +44,8 @@ function unlockNodes(nodes) { var lockedNodes = []; try { // lock secondaries - jsTestLog('Locking nodes: ' + tojson(replTest.liveNodes.slaves)); - replTest.liveNodes.slaves.forEach(function(node) { + jsTestLog('Locking nodes: ' + tojson(replTest._slaves)); + replTest._slaves.forEach(function(node) { jsTestLog('Locking node: ' + node); jsTestLog( 'fsync lock ' + node + ' result: ' + @@ -125,8 +125,8 @@ assert.soon(function() { replTest.add(); print("\ncheck shutdown command"); -master = replTest.liveNodes.master; -var slave = replTest.liveNodes.slaves[0]; +master = replTest._master; +var slave = replTest._slaves[0]; try { slave.adminCommand({shutdown: 1}); diff --git a/jstests/replsets/stepdown3.js b/jstests/replsets/stepdown3.js index c04aee96d76..cdce9057cd9 100644 --- a/jstests/replsets/stepdown3.js +++ b/jstests/replsets/stepdown3.js @@ -23,7 +23,7 @@ assert.writeOK(master.getDB("test").foo.insert({x: 2}, options)); // lock secondary, to pause replication print("\nlock secondary"); - var locked = replTest.liveNodes.slaves[0]; + var locked = replTest._slaves[0]; printjson(locked.getDB("admin").runCommand({fsync: 1, lock: 1})); // do a write diff --git a/jstests/replsets/sync_passive.js b/jstests/replsets/sync_passive.js index fed5c027201..c97d320c96e 100644 --- a/jstests/replsets/sync_passive.js +++ b/jstests/replsets/sync_passive.js @@ -33,7 +33,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY); var master = replTest.getPrimary().getDB("test"); var server0 = master; -var server1 = replTest.liveNodes.slaves[0]; +var server1 = replTest._slaves[0]; print("Initial sync"); for (var i = 0; i < 100; i++) { @@ -48,7 +48,8 @@ print("add some data"); for (var i = 0; i < 1000; i++) { master.bar.insert({x: i}); } -replTest.awaitReplication(); +const liveSlaves = [replTest.nodes[2]]; +replTest.awaitReplication(null, null, liveSlaves); print("stop #0"); replTest.stop(0); @@ -57,7 +58,7 @@ print("restart #1"); replTest.restart(1); print("check sync"); -replTest.awaitReplication(); +replTest.awaitReplication(null, null, liveSlaves); print("add data"); reconnect(server1); @@ -65,7 +66,7 @@ master = replTest.getPrimary().getDB("test"); for (var i = 0; i < 1000; i++) { master.bar.insert({x: i}); } -replTest.awaitReplication(); +replTest.awaitReplication(null, null, liveSlaves); print("kill #1"); replTest.stop(1); @@ -75,7 +76,7 @@ replTest.restart(0); reconnect(server0); print("wait for sync"); -replTest.awaitReplication(); +replTest.awaitReplication(null, null, liveSlaves); print("bring #1 back up, make sure everything's okay"); replTest.restart(1); |