diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-05-28 17:55:12 -0400 |
commit | 6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch) | |
tree | c8cfb5acb62c80f375bc37e7d4350382deea6a37 /jstests/replsets | |
parent | d4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff) | |
download | mongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz |
SERVER-23971 Clang-Format code
Diffstat (limited to 'jstests/replsets')
52 files changed, 218 insertions, 289 deletions
diff --git a/jstests/replsets/apply_batch_only_goes_forward.js b/jstests/replsets/apply_batch_only_goes_forward.js index 4744fcf4342..a461e9fad12 100644 --- a/jstests/replsets/apply_batch_only_goes_forward.js +++ b/jstests/replsets/apply_batch_only_goes_forward.js @@ -35,10 +35,7 @@ var sLocal = slave.getDB("local"); var sMinvalid = sLocal["replset.minvalid"]; var stepDownSecs = 30; - var stepDownCmd = { - replSetStepDown: stepDownSecs, - force: true - }; + var stepDownCmd = {replSetStepDown: stepDownSecs, force: true}; // Write op assert.writeOK(mTest.foo.save({}, {writeConcern: {w: 3}})); @@ -50,9 +47,11 @@ var farFutureTS = new Timestamp( Math.floor(new Date().getTime() / 1000) + (60 * 60 * 24 * 5 /* in five days*/), 0); var rsgs = assert.commandWorked(mLocal.adminCommand("replSetGetStatus")); - var primaryOpTime = rsgs.members.filter(function(member) { - return member.self; - })[0].optime; + var primaryOpTime = rsgs.members + .filter(function(member) { + return member.self; + })[0] + .optime; jsTest.log("future TS: " + tojson(farFutureTS) + ", date:" + tsToDate(farFutureTS)); // We do an update in case there is a minvalid document on the primary already. // If the doc doesn't exist then upsert:true will create it, and the writeConcern ensures diff --git a/jstests/replsets/apply_ops_lastop.js b/jstests/replsets/apply_ops_lastop.js index 1e7df9a9035..e3ff0f19554 100644 --- a/jstests/replsets/apply_ops_lastop.js +++ b/jstests/replsets/apply_ops_lastop.js @@ -27,15 +27,12 @@ var insertApplyOps = [{op: "i", ns: 'foo.bar', o: {_id: 1, a: "b"}}]; var deleteApplyOps = [{op: "d", ns: 'foo.bar', o: {_id: 1, a: "b"}}]; var badPreCondition = [{ns: 'foo.bar', q: {_id: 10, a: "aaa"}, res: {a: "aaa"}}]; - var majorityWriteConcern = { - w: 'majority', - wtimeout: 30000 - }; + var majorityWriteConcern = {w: 'majority', wtimeout: 30000}; // Set up some data assert.writeOK(coll.insert({x: 1})); // creating the collection so applyOps works - assert.commandWorked(m1.getDB('foo').runCommand( - {applyOps: insertApplyOps, writeConcern: majorityWriteConcern})); + assert.commandWorked( + m1.getDB('foo').runCommand({applyOps: insertApplyOps, writeConcern: majorityWriteConcern})); var insertOp = m1.getDB('foo').getLastErrorObj('majority', 30000).lastOp; // No-op applyOps diff --git a/jstests/replsets/apply_ops_wc.js b/jstests/replsets/apply_ops_wc.js index 0b8a49e19bd..b0c4fed59c4 100644 --- a/jstests/replsets/apply_ops_wc.js +++ b/jstests/replsets/apply_ops_wc.js @@ -71,7 +71,10 @@ var secondaries = replTest.getSecondaries(); - var majorityWriteConcerns = [{w: 2, wtimeout: 30000}, {w: 'majority', wtimeout: 30000}, ]; + var majorityWriteConcerns = [ + {w: 2, wtimeout: 30000}, + {w: 'majority', wtimeout: 30000}, + ]; function testMajorityWriteConcerns(wc) { jsTest.log("Testing " + tojson(wc)); diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js index d41ef9ba5ef..13c5f1da260 100644 --- a/jstests/replsets/auth1.js +++ b/jstests/replsets/auth1.js @@ -32,9 +32,8 @@ m = runMongoProgram( "mongod", "--keyFile", key1_644, "--port", port[0], "--dbpath", MongoRunner.dataPath + name); print("should fail with wrong permissions"); -assert.eq(m, - _isWindows() ? 100 : 1, - "mongod should exit w/ 1 (EXIT_FAILURE): permissions too open"); +assert.eq( + m, _isWindows() ? 100 : 1, "mongod should exit w/ 1 (EXIT_FAILURE): permissions too open"); MongoRunner.stopMongod(port[0]); print("add a user to server0: foo"); @@ -74,9 +73,14 @@ assert.eq(r.x, 1); slave.setSlaveOk(); function doQueryOn(p) { - var error = assert.throws(function() { - r = p.getDB("test").foo.findOne(); - }, [], "find did not throw, returned: " + tojson(r)).toString(); + var error = assert + .throws( + function() { + r = p.getDB("test").foo.findOne(); + }, + [], + "find did not throw, returned: " + tojson(r)) + .toString(); printjson(error); assert.gt(error.indexOf("not authorized"), -1, "error was non-auth"); } diff --git a/jstests/replsets/auth2.js b/jstests/replsets/auth2.js index f7b8d8ab468..2300b03bf9c 100644 --- a/jstests/replsets/auth2.js +++ b/jstests/replsets/auth2.js @@ -44,8 +44,8 @@ rs.initiate({ var master = rs.getPrimary(); print("add an admin user"); -master.getDB("admin") - .createUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles}, {w: 3, wtimeout: 30000}); +master.getDB("admin").createUser({user: "foo", pwd: "bar", roles: jsTest.adminUserRoles}, + {w: 3, wtimeout: 30000}); var m = rs.nodes[0]; print("starting 1 and 2 with key file"); diff --git a/jstests/replsets/auth3.js b/jstests/replsets/auth3.js index 3ac812bcfa1..bebee24be1b 100644 --- a/jstests/replsets/auth3.js +++ b/jstests/replsets/auth3.js @@ -36,11 +36,9 @@ jsTest.log("make common point"); safeInsert(); - authutil.asCluster(rs.nodes, - keyfile, - function() { - rs.awaitReplication(); - }); + authutil.asCluster(rs.nodes, keyfile, function() { + rs.awaitReplication(); + }); jsTest.log("write stuff to 0&2"); rs.stop(1); @@ -63,10 +61,8 @@ jsTest.log("doing rollback!"); - authutil.asCluster(rs.nodes, - keyfile, - function() { - rs.awaitSecondaryNodes(); - }); + authutil.asCluster(rs.nodes, keyfile, function() { + rs.awaitSecondaryNodes(); + }); }()); diff --git a/jstests/replsets/batch_write_command_wc.js b/jstests/replsets/batch_write_command_wc.js index d6f83c08e3a..b86fd8c80a8 100644 --- a/jstests/replsets/batch_write_command_wc.js +++ b/jstests/replsets/batch_write_command_wc.js @@ -22,7 +22,10 @@ var coll = mongod.getCollection("test.batch_write_command_wc"); // // Basic insert, default WC coll.remove({}); -printjson(request = {insert: coll.getName(), documents: [{a: 1}]}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}] +}); printjson(result = coll.runCommand(request)); assert(result.ok); assert.eq(1, result.n); @@ -31,7 +34,11 @@ assert.eq(1, coll.count()); // // Basic insert, majority WC coll.remove({}); -printjson(request = {insert: coll.getName(), documents: [{a: 1}], writeConcern: {w: 'majority'}}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}], + writeConcern: {w: 'majority'} +}); printjson(result = coll.runCommand(request)); assert(result.ok); assert.eq(1, result.n); @@ -40,7 +47,11 @@ assert.eq(1, coll.count()); // // Basic insert, w:2 WC coll.remove({}); -printjson(request = {insert: coll.getName(), documents: [{a: 1}], writeConcern: {w: 2}}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}], + writeConcern: {w: 2} +}); printjson(result = coll.runCommand(request)); assert(result.ok); assert.eq(1, result.n); @@ -49,7 +60,11 @@ assert.eq(1, coll.count()); // // Basic insert, immediate nojournal error coll.remove({}); -printjson(request = {insert: coll.getName(), documents: [{a: 1}], writeConcern: {j: true}}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}], + writeConcern: {j: true} +}); printjson(result = coll.runCommand(request)); assert(!result.ok); assert.eq(0, coll.count()); @@ -57,8 +72,11 @@ assert.eq(0, coll.count()); // // Basic insert, timeout wc error coll.remove({}); -printjson( - request = {insert: coll.getName(), documents: [{a: 1}], writeConcern: {w: 3, wtimeout: 1}}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}], + writeConcern: {w: 3, wtimeout: 1} +}); printjson(result = coll.runCommand(request)); assert(result.ok); assert.eq(1, result.n); @@ -69,7 +87,11 @@ assert.eq(1, coll.count()); // // Basic insert, wmode wc error coll.remove({}); -printjson(request = {insert: coll.getName(), documents: [{a: 1}], writeConcern: {w: 'invalid'}}); +printjson(request = { + insert: coll.getName(), + documents: [{a: 1}], + writeConcern: {w: 'invalid'} +}); printjson(result = coll.runCommand(request)); assert(result.ok); assert.eq(1, result.n); diff --git a/jstests/replsets/capped_id.js b/jstests/replsets/capped_id.js index 8708f5752f8..ee05e810d59 100644 --- a/jstests/replsets/capped_id.js +++ b/jstests/replsets/capped_id.js @@ -40,9 +40,12 @@ var slave1db = slave1.getDB(dbname); var slave2db = slave2.getDB(dbname); function countIdIndexes(theDB, coll) { - return theDB[coll].getIndexes().filter(function(idx) { - return friendlyEqual(idx.key, {_id: 1}); - }).length; + return theDB[coll] + .getIndexes() + .filter(function(idx) { + return friendlyEqual(idx.key, {_id: 1}); + }) + .length; } var numtests = 4; diff --git a/jstests/replsets/chaining_removal.js b/jstests/replsets/chaining_removal.js index dbc80148745..929e452844f 100644 --- a/jstests/replsets/chaining_removal.js +++ b/jstests/replsets/chaining_removal.js @@ -49,9 +49,7 @@ // write that should reach all nodes var timeout = 60 * 1000; - var options = { - writeConcern: {w: numNodes, wtimeout: timeout} - }; + var options = {writeConcern: {w: numNodes, wtimeout: timeout}}; assert.writeOK(primary.getDB(name).foo.insert({x: 1}, options)); var config = primary.getDB("local").system.replset.findOne(); diff --git a/jstests/replsets/commands_that_write_accept_wc.js b/jstests/replsets/commands_that_write_accept_wc.js index 9f35d5c6549..83a341767c2 100644 --- a/jstests/replsets/commands_that_write_accept_wc.js +++ b/jstests/replsets/commands_that_write_accept_wc.js @@ -99,9 +99,7 @@ load('jstests/libs/write_concern_util.js'); }); }, reduce: function(key, values) { - return { - count: values.length - }; + return {count: values.length}; }, out: "foo" }, @@ -120,10 +118,7 @@ load('jstests/libs/write_concern_util.js'); }); function testValidWriteConcern(cmd) { - cmd.req.writeConcern = { - w: 'majority', - wtimeout: 25000 - }; + cmd.req.writeConcern = {w: 'majority', wtimeout: 25000}; jsTest.log("Testing " + tojson(cmd.req)); dropTestCollection(); @@ -136,9 +131,7 @@ load('jstests/libs/write_concern_util.js'); } function testInvalidWriteConcern(cmd) { - cmd.req.writeConcern = { - w: 'invalid' - }; + cmd.req.writeConcern = {w: 'invalid'}; jsTest.log("Testing " + tojson(cmd.req)); dropTestCollection(); diff --git a/jstests/replsets/config_server_checks.js b/jstests/replsets/config_server_checks.js index 041b3a29699..f5dfab883cf 100644 --- a/jstests/replsets/config_server_checks.js +++ b/jstests/replsets/config_server_checks.js @@ -89,11 +89,8 @@ function expectState(rst, state) { // fail to // start up and won't automatically add "configsvr" to the replset config (SERVER-21236). jsTestLog("set initiated without configsvr, restarted adding --configsvr cmd line"); - var rst = new ReplSetTest({ - name: "configrs7", - nodes: 1, - nodeOptions: {journal: "", storageEngine: "wiredTiger"} - }); + var rst = new ReplSetTest( + {name: "configrs7", nodes: 1, nodeOptions: {journal: "", storageEngine: "wiredTiger"}}); rst.startSet(); var conf = rst.getReplSetConfig(); diff --git a/jstests/replsets/disallow_adding_initialized_node1.js b/jstests/replsets/disallow_adding_initialized_node1.js index 8d4491975b6..f2a6b3053fb 100644 --- a/jstests/replsets/disallow_adding_initialized_node1.js +++ b/jstests/replsets/disallow_adding_initialized_node1.js @@ -7,11 +7,21 @@ 'use strict'; var name = 'disallow_adding_initialized_node1'; - var replSetA = new ReplSetTest({name: name, nodes: [{rsConfig: {_id: 10}}, ]}); + var replSetA = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {_id: 10}}, + ] + }); replSetA.startSet({dbpath: "$set-A-$node"}); replSetA.initiate(); - var replSetB = new ReplSetTest({name: name, nodes: [{rsConfig: {_id: 20}}, ]}); + var replSetB = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {_id: 20}}, + ] + }); replSetB.startSet({dbpath: "$set-B-$node"}); replSetB.initiate(); diff --git a/jstests/replsets/disallow_adding_initialized_node2.js b/jstests/replsets/disallow_adding_initialized_node2.js index c4125f7c069..5778a3c3e8b 100644 --- a/jstests/replsets/disallow_adding_initialized_node2.js +++ b/jstests/replsets/disallow_adding_initialized_node2.js @@ -12,12 +12,22 @@ 'use strict'; var name = 'disallow_adding_initialized_node2'; - var replSetA = new ReplSetTest( - {name: name, nodes: [{rsConfig: {_id: 10}}, {rsConfig: {_id: 11, arbiterOnly: true}}, ]}); + var replSetA = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {_id: 10}}, + {rsConfig: {_id: 11, arbiterOnly: true}}, + ] + }); replSetA.startSet({dbpath: "$set-A-$node"}); replSetA.initiate(); - var replSetB = new ReplSetTest({name: name, nodes: [{rsConfig: {_id: 20}}, ]}); + var replSetB = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {_id: 20}}, + ] + }); replSetB.startSet({dbpath: "$set-B-$node"}); replSetB.initiate(); diff --git a/jstests/replsets/initial_sync1.js b/jstests/replsets/initial_sync1.js index 3977445743e..ceb614b68a6 100644 --- a/jstests/replsets/initial_sync1.js +++ b/jstests/replsets/initial_sync1.js @@ -77,9 +77,8 @@ wait(function() { return config2.version == config.version && (config3 && config3.version == config.version); }); -replTest.waitForState(slave2, - [ReplSetTest.State.SECONDARY, ReplSetTest.State.RECOVERING], - 60 * 1000); +replTest.waitForState( + slave2, [ReplSetTest.State.SECONDARY, ReplSetTest.State.RECOVERING], 60 * 1000); print("7. Kill the secondary in the middle of syncing"); replTest.stop(slave1); diff --git a/jstests/replsets/initial_sync_update_missing_doc2.js b/jstests/replsets/initial_sync_update_missing_doc2.js index 559fda41534..f8333baa41a 100644 --- a/jstests/replsets/initial_sync_update_missing_doc2.js +++ b/jstests/replsets/initial_sync_update_missing_doc2.js @@ -60,10 +60,7 @@ checkLog(secondary, 'initial sync - initialSyncHangBeforeGettingMissingDocument fail point enabled'); - var doc = { - _id: 0, - x: 3 - }; + var doc = {_id: 0, x: 3}; // Re-insert deleted document. assert.writeOK(coll.insert(doc, {writeConcern: {w: 1}})); diff --git a/jstests/replsets/localhostAuthBypass.js b/jstests/replsets/localhostAuthBypass.js index 2b2332d258a..22a512f19d0 100644 --- a/jstests/replsets/localhostAuthBypass.js +++ b/jstests/replsets/localhostAuthBypass.js @@ -68,17 +68,13 @@ var assertCannotRunCommands = function(mongo, isPrimary) { {param: "userCacheInvalidationIntervalSecs", val: 300} ]; params.forEach(function(p) { - var cmd = { - setParameter: 1 - }; + var cmd = {setParameter: 1}; cmd[p.param] = p.val; assert.commandFailedWithCode( mongo.getDB("admin").runCommand(cmd), authorizeErrorCode, "setParameter: " + p.param); }); params.forEach(function(p) { - var cmd = { - getParameter: 1 - }; + var cmd = {getParameter: 1}; cmd[p.param] = 1; assert.commandFailedWithCode( mongo.getDB("admin").runCommand(cmd), authorizeErrorCode, "getParameter: " + p.param); @@ -221,8 +217,8 @@ var runNonlocalTest = function(ipAddr) { }); assert.throws(function() { - mongo.getDB("admin") - .createUser({user: username, pwd: password, roles: jsTest.adminUserRoles}); + mongo.getDB("admin").createUser( + {user: username, pwd: password, roles: jsTest.adminUserRoles}); }); shutdown(rs); diff --git a/jstests/replsets/oplog_format.js b/jstests/replsets/oplog_format.js index e597197fed0..a2c37d294a5 100644 --- a/jstests/replsets/oplog_format.js +++ b/jstests/replsets/oplog_format.js @@ -169,8 +169,8 @@ assertLastOplog({$set: {"a.b": [{c: 1}, {c: 2}]}}, {_id: 1}, msg); var msg = "bad array $push $slice $sort reversed first two"; coll.save({_id: 1, a: {b: [{c: 1}, {c: 2}]}}); -res = assert.writeOK(coll.update( - {_id: {$gt: 0}}, {$push: {"a.b": {$each: [{c: -1}], $slice: -2, $sort: {c: -1}}}})); +res = assert.writeOK( + coll.update({_id: {$gt: 0}}, {$push: {"a.b": {$each: [{c: -1}], $slice: -2, $sort: {c: -1}}}})); assert.eq(res.nModified, 1, "update failed for '" + msg + "': " + res.toString()); assert.docEq({_id: 1, a: {b: [{c: 1}, {c: -1}]}}, coll.findOne({}), msg); assertLastOplog({$set: {"a.b": [{c: 1}, {c: -1}]}}, {_id: 1}, msg); diff --git a/jstests/replsets/optime.js b/jstests/replsets/optime.js index a716ca3dbca..5403ab35bcd 100644 --- a/jstests/replsets/optime.js +++ b/jstests/replsets/optime.js @@ -42,9 +42,7 @@ var initialInfo = master.getDB('admin').serverStatus({oplog: true}).oplog; // Do an insert to increment optime, but without rolling the oplog // latestOptime should be updated, but earliestOptime should be unchanged -var options = { - writeConcern: {w: replTest.nodes.length} -}; +var options = {writeConcern: {w: replTest.nodes.length}}; assert.writeOK(master.getDB('test').foo.insert({a: 1}, options)); assert(optimesAreEqual(replTest)); diff --git a/jstests/replsets/pipelineout.js b/jstests/replsets/pipelineout.js index bb86f98c4e9..91e07d9a457 100644 --- a/jstests/replsets/pipelineout.js +++ b/jstests/replsets/pipelineout.js @@ -12,21 +12,21 @@ var secondary = replTest.liveNodes.slaves[0].getDB(name); // populate the collection for (i = 0; i < 5; i++) { - primary.in.insert({x: i}); + primary.in .insert({x: i}); } replTest.awaitReplication(); // make sure $out cannot be run on a secondary assert.throws(function() { - secondary.in.aggregate({$out: "out"}).itcount; + secondary.in .aggregate({$out: "out"}).itcount; }); // even if slaveOk secondary.setSlaveOk(); assert.throws(function() { - secondary.in.aggregate({$out: "out"}).itcount; + secondary.in .aggregate({$out: "out"}).itcount; }); // run one and check for proper replication -primary.in.aggregate({$out: "out"}).itcount; +primary.in .aggregate({$out: "out"}).itcount; replTest.awaitReplication(); assert.eq(primary.out.find().sort({x: 1}).toArray(), secondary.out.find().sort({x: 1}).toArray()); diff --git a/jstests/replsets/priority_takeover_one_node_higher_priority.js b/jstests/replsets/priority_takeover_one_node_higher_priority.js index e718ef131f9..8c909c643c3 100644 --- a/jstests/replsets/priority_takeover_one_node_higher_priority.js +++ b/jstests/replsets/priority_takeover_one_node_higher_priority.js @@ -8,8 +8,14 @@ load('jstests/replsets/rslib.js'); var name = 'priority_takeover_one_node_higher_priority'; - var replSet = new ReplSetTest( - {name: name, nodes: [{rsConfig: {priority: 3}}, {}, {rsConfig: {arbiterOnly: true}}, ]}); + var replSet = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {priority: 3}}, + {}, + {rsConfig: {arbiterOnly: true}}, + ] + }); replSet.startSet(); replSet.initiate(); diff --git a/jstests/replsets/priority_takeover_two_nodes_equal_priority.js b/jstests/replsets/priority_takeover_two_nodes_equal_priority.js index 42134f9430e..b6e8cc25b77 100644 --- a/jstests/replsets/priority_takeover_two_nodes_equal_priority.js +++ b/jstests/replsets/priority_takeover_two_nodes_equal_priority.js @@ -8,8 +8,14 @@ load('jstests/replsets/rslib.js'); 'use strict'; var name = 'priority_takeover_two_nodes_equal_priority'; - var replSet = new ReplSetTest( - {name: name, nodes: [{rsConfig: {priority: 3}}, {rsConfig: {priority: 3}}, {}, ]}); + var replSet = new ReplSetTest({ + name: name, + nodes: [ + {rsConfig: {priority: 3}}, + {rsConfig: {priority: 3}}, + {}, + ] + }); replSet.startSet(); replSet.initiate(); diff --git a/jstests/replsets/read_committed.js b/jstests/replsets/read_committed.js index be051ffbee8..bed22c08248 100644 --- a/jstests/replsets/read_committed.js +++ b/jstests/replsets/read_committed.js @@ -11,9 +11,7 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. (function() { "use strict"; - const majorityWriteConcern = { - writeConcern: {w: "majority", wtimeout: 60 * 1000} - }; + const majorityWriteConcern = {writeConcern: {w: "majority", wtimeout: 60 * 1000}}; // Each test case includes a 'prepareCollection' method that sets up the initial state starting // with an empty collection, a 'write' method that does some write, and two arrays, @@ -105,13 +103,12 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. function readLatestOplogEntry(readConcernLevel) { var oplog = primary.getDB('local').oplog.rs; - var res = oplog.runCommand('find', - { - "readConcern": {"level": readConcernLevel}, - "maxTimeMS": 3000, - sort: {$natural: -1}, - limit: 1, - }); + var res = oplog.runCommand('find', { + "readConcern": {"level": readConcernLevel}, + "maxTimeMS": 3000, + sort: {$natural: -1}, + limit: 1, + }); assert.commandWorked(res); return new DBCommandCursor(coll.getMongo(), res).toArray()[0]; } diff --git a/jstests/replsets/read_committed_with_catalog_changes.js b/jstests/replsets/read_committed_with_catalog_changes.js index 14eec54cab4..03b9808f9a0 100644 --- a/jstests/replsets/read_committed_with_catalog_changes.js +++ b/jstests/replsets/read_committed_with_catalog_changes.js @@ -215,8 +215,8 @@ load("jstests/replsets/rslib.js"); // For startSetIfSupportsReadMajority. } function assertReadsSucceed(coll, timeoutMs = 10000) { - var res = coll.runCommand('find', - {"readConcern": {"level": "majority"}, "maxTimeMS": timeoutMs}); + var res = + coll.runCommand('find', {"readConcern": {"level": "majority"}, "maxTimeMS": timeoutMs}); assert.commandWorked(res, 'reading from ' + coll.getFullName()); // Exhaust the cursor to avoid leaking cursors on the server. new DBCommandCursor(coll.getMongo(), res).itcount(); diff --git a/jstests/replsets/reconfig.js b/jstests/replsets/reconfig.js index 1351aa1d54b..312a3cb6243 100644 --- a/jstests/replsets/reconfig.js +++ b/jstests/replsets/reconfig.js @@ -23,11 +23,7 @@ jsTestLog("Invalid reconfig"); config.version++; - var badMember = { - _id: numNodes, - host: "localhost:12345", - priority: "High" - }; + var badMember = {_id: numNodes, host: "localhost:12345", priority: "High"}; config.members.push(badMember); var invalidConfigCode = 93; assert.commandFailedWithCode(primary.adminCommand({replSetReconfig: config}), diff --git a/jstests/replsets/reconfig_tags.js b/jstests/replsets/reconfig_tags.js index 3c4d0e2616d..86a2419f4e9 100644 --- a/jstests/replsets/reconfig_tags.js +++ b/jstests/replsets/reconfig_tags.js @@ -12,15 +12,9 @@ var rsConfig = primary.getDB("local").system.replset.findOne(); jsTest.log('got rsconf ' + tojson(rsConfig)); rsConfig.members.forEach(function(member) { if (member.host == primary.host) { - member.tags = { - dc: 'ny', - tag: 'one' - }; + member.tags = {dc: 'ny', tag: 'one'}; } else { - member.tags = { - dc: 'ny', - tag: 'two' - }; + member.tags = {dc: 'ny', tag: 'two'}; } }); diff --git a/jstests/replsets/remove1.js b/jstests/replsets/remove1.js index cde4974677a..f587275570a 100644 --- a/jstests/replsets/remove1.js +++ b/jstests/replsets/remove1.js @@ -55,9 +55,8 @@ assert.soon(function() { }); // Now we should successfully reconnect to the secondary. -assert.eq(secondary.getDB("admin").runCommand({ping: 1}).ok, - 1, - "we aren't connected to the secondary"); +assert.eq( + secondary.getDB("admin").runCommand({ping: 1}).ok, 1, "we aren't connected to the secondary"); reconnect(master); diff --git a/jstests/replsets/repl_options.js b/jstests/replsets/repl_options.js index 66a07787889..a0af2fa2573 100644 --- a/jstests/replsets/repl_options.js +++ b/jstests/replsets/repl_options.js @@ -3,9 +3,7 @@ var baseName = "jstests_repl_repl_options"; load('jstests/libs/command_line/test_parsed_options.js'); jsTest.log("Testing \"replSet\" command line option"); -var expectedResult = { - "parsed": {"replication": {"replSet": "mycmdlinename"}} -}; +var expectedResult = {"parsed": {"replication": {"replSet": "mycmdlinename"}}}; testGetCmdLineOptsMongod({replSet: "mycmdlinename"}, expectedResult); jsTest.log("Testing \"replication.replSetName\" config file option"); diff --git a/jstests/replsets/replset2.js b/jstests/replsets/replset2.js index b50a939242d..d578fe0d4b4 100644 --- a/jstests/replsets/replset2.js +++ b/jstests/replsets/replset2.js @@ -66,9 +66,7 @@ doTest = function(signal) { // Test write concern with a simple insert print("replset2.js **** Try inserting a single record ****"); master.getDB(testDB).dropDatabase(); - var options = { - writeConcern: {w: 3, wtimeout: 10000} - }; + var options = {writeConcern: {w: 3, wtimeout: 10000}}; assert.writeOK(master.getDB(testDB).foo.insert({n: 1}, options)); m1 = master.getDB(testDB).foo.findOne({n: 1}); diff --git a/jstests/replsets/replset5.js b/jstests/replsets/replset5.js index c0aee6e1154..65f2b66212e 100644 --- a/jstests/replsets/replset5.js +++ b/jstests/replsets/replset5.js @@ -11,10 +11,7 @@ load("jstests/replsets/rslib.js"); // Initiate set with default for write concern var config = replTest.getReplSetConfig(); config.settings = {}; - config.settings.getLastErrorDefaults = { - 'w': 3, - 'wtimeout': 20000 - }; + config.settings.getLastErrorDefaults = {'w': 3, 'wtimeout': 20000}; config.settings.heartbeatTimeoutSecs = 15; // Prevent node 2 from becoming primary, as we will attempt to set it to hidden later. config.members[2].priority = 0; diff --git a/jstests/replsets/replset7.js b/jstests/replsets/replset7.js index 8b13f2ed7e2..94dff59b33f 100644 --- a/jstests/replsets/replset7.js +++ b/jstests/replsets/replset7.js @@ -45,7 +45,10 @@ rt.awaitSecondaryNodes(); // Do we have an index? assert.eq(1, - slave.getDB('d')['c'].getIndexes().filter(function(doc) { - return (doc.v === 1 && JSON.stringify(doc.key) === JSON.stringify({x: 1}) && - doc.ns === 'd.c' && doc.name === 'x_1'); - }).length); + slave.getDB('d')['c'] + .getIndexes() + .filter(function(doc) { + return (doc.v === 1 && JSON.stringify(doc.key) === JSON.stringify({x: 1}) && + doc.ns === 'd.c' && doc.name === 'x_1'); + }) + .length); diff --git a/jstests/replsets/rollback5.js b/jstests/replsets/rollback5.js index e63b7ab34ea..42649dc5162 100644 --- a/jstests/replsets/rollback5.js +++ b/jstests/replsets/rollback5.js @@ -44,10 +44,7 @@ assert.soon(function() { return res.myState == 7; }, "Arbiter failed to initialize."); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(A.foo.update({key: 'value1'}, {$set: {req: 'req'}}, options)); replTest.stop(AID); diff --git a/jstests/replsets/rollback_auth.js b/jstests/replsets/rollback_auth.js index 0c0b35b91ed..85f4a0c4991 100644 --- a/jstests/replsets/rollback_auth.js +++ b/jstests/replsets/rollback_auth.js @@ -125,15 +125,14 @@ // Modify the the user and role in a way that will be rolled back. b.grantPrivilegesToRole( 'myRole', - [{resource: {db: 'test', collection: 'foo'}, actions: ['collStats']}], - {}); // Default write concern will wait for majority, which will time out. - b.createRole( - { - role: 'temporaryRole', - roles: [], - privileges: [{resource: {db: 'test', collection: 'bar'}, actions: ['collStats']}] - }, + [{resource: {db: 'test', collection: 'foo'}, actions: ['collStats']}], {}); // Default write concern will wait for majority, which will time out. + b.createRole({ + role: 'temporaryRole', + roles: [], + privileges: [{resource: {db: 'test', collection: 'bar'}, actions: ['collStats']}] + }, + {}); // Default write concern will wait for majority, which will time out. b.grantRolesToUser('spencer', ['temporaryRole'], {}); // Default write concern will wait for majority, which will time out. @@ -172,13 +171,12 @@ a.grantPrivilegesToRole( 'myRole', [{resource: {db: 'test', collection: 'baz'}, actions: ['collStats']}], {}); - a.createRole( - { - role: 'persistentRole', - roles: [], - privileges: [{resource: {db: 'test', collection: 'foobar'}, actions: ['collStats']}] - }, - {}); + a.createRole({ + role: 'persistentRole', + roles: [], + privileges: [{resource: {db: 'test', collection: 'foobar'}, actions: ['collStats']}] + }, + {}); a.grantRolesToUser('spencer', ['persistentRole'], {}); A.logout(); a.auth('spencer', 'pwd'); @@ -191,11 +189,9 @@ // bring B back in contact with A // as A is primary, B will roll back and then catch up replTest.restart(1); - authutil.asCluster(replTest.nodes, - 'jstests/libs/key1', - function() { - replTest.awaitReplication(); - }); + authutil.asCluster(replTest.nodes, 'jstests/libs/key1', function() { + replTest.awaitReplication(); + }); assert.soon(function() { return b.auth('spencer', 'pwd'); }); diff --git a/jstests/replsets/rollback_cmd_unrollbackable.js b/jstests/replsets/rollback_cmd_unrollbackable.js index 801d4c285a7..cf176ab312d 100644 --- a/jstests/replsets/rollback_cmd_unrollbackable.js +++ b/jstests/replsets/rollback_cmd_unrollbackable.js @@ -30,10 +30,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_collMod_PowerOf2Sizes.js b/jstests/replsets/rollback_collMod_PowerOf2Sizes.js index deab19b2f09..24177ebe6b7 100644 --- a/jstests/replsets/rollback_collMod_PowerOf2Sizes.js +++ b/jstests/replsets/rollback_collMod_PowerOf2Sizes.js @@ -43,10 +43,7 @@ }; assert.commandWorked(a_conn.getDB(name).createCollection('foo', originalCollectionOptions)); - var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true - }; + var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); assert.eq(getOptions(a_conn), originalCollectionOptions); @@ -64,9 +61,8 @@ validationLevel: "moderate", validationAction: "warn" })); - assert.eq( - getOptions(a_conn), - {flags: 2, validator: {a: 1}, validationLevel: "moderate", validationAction: "warn"}); + assert.eq(getOptions(a_conn), + {flags: 2, validator: {a: 1}, validationLevel: "moderate", validationAction: "warn"}); // Shut down A and fail over to B. replTest.stop(AID); @@ -76,10 +72,7 @@ b_conn = master; // Do a write on B so that A will have to roll back. - options = { - writeConcern: {w: 1, wtimeout: 60000}, - upsert: true - }; + options = {writeConcern: {w: 1, wtimeout: 60000}, upsert: true}; assert.writeOK(b_conn.getDB(name).foo.insert({x: 2}, options)); // Restart A, which should rollback the collMod before becoming primary. diff --git a/jstests/replsets/rollback_collMod_fatal.js b/jstests/replsets/rollback_collMod_fatal.js index c907213f05d..0fcec31f6fc 100644 --- a/jstests/replsets/rollback_collMod_fatal.js +++ b/jstests/replsets/rollback_collMod_fatal.js @@ -31,10 +31,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; a_conn.getDB(name).foo.ensureIndex({x: 1}, {expireAfterSeconds: 3600}); assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); diff --git a/jstests/replsets/rollback_different_h.js b/jstests/replsets/rollback_different_h.js index 4b9aede1bbc..1d753ea46c6 100644 --- a/jstests/replsets/rollback_different_h.js +++ b/jstests/replsets/rollback_different_h.js @@ -42,10 +42,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_dropdb.js b/jstests/replsets/rollback_dropdb.js index c11b14ab06e..818d74b2ad2 100644 --- a/jstests/replsets/rollback_dropdb.js +++ b/jstests/replsets/rollback_dropdb.js @@ -31,10 +31,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_empty_ns.js b/jstests/replsets/rollback_empty_ns.js index f6a07319eb4..44be3b0bbb4 100644 --- a/jstests/replsets/rollback_empty_ns.js +++ b/jstests/replsets/rollback_empty_ns.js @@ -42,10 +42,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_empty_o.js b/jstests/replsets/rollback_empty_o.js index f3468fcde5e..ebce959f704 100644 --- a/jstests/replsets/rollback_empty_o.js +++ b/jstests/replsets/rollback_empty_o.js @@ -42,10 +42,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_empty_o2.js b/jstests/replsets/rollback_empty_o2.js index 56eb8512575..bf13aac67ad 100644 --- a/jstests/replsets/rollback_empty_o2.js +++ b/jstests/replsets/rollback_empty_o2.js @@ -42,10 +42,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_fake_cmd.js b/jstests/replsets/rollback_fake_cmd.js index 175359121f8..f6ce306ba08 100644 --- a/jstests/replsets/rollback_fake_cmd.js +++ b/jstests/replsets/rollback_fake_cmd.js @@ -42,10 +42,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master diff --git a/jstests/replsets/rollback_index.js b/jstests/replsets/rollback_index.js index 6fb3044b740..ca03075ad2b 100644 --- a/jstests/replsets/rollback_index.js +++ b/jstests/replsets/rollback_index.js @@ -44,10 +44,7 @@ replTest.waitForState(replTest.nodes[0], ReplSetTest.State.PRIMARY, 60 * 1000); var master = replTest.getPrimary(); assert(master === conns[0], "conns[0] assumed to be master"); assert(a_conn.host === master.host, "a_conn assumed to be master"); -var options = { - writeConcern: {w: 2, wtimeout: 60000}, - upsert: true -}; +var options = {writeConcern: {w: 2, wtimeout: 60000}, upsert: true}; assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); // shut down master @@ -97,9 +94,9 @@ assert.writeOK(a_conn.getDB(name).foo.insert({x: 1}, options)); assert.eq(3, b_conn.getDB(name).foo.count(), 'Collection on B does not have the same number of documents as A'); -assert.eq(a_conn.getDB(name).foo.getIndexes().length, - b_conn.getDB(name).foo.getIndexes().length, - 'Unique index not dropped during rollback: ' + - tojson(b_conn.getDB(name).foo.getIndexes())); +assert.eq( + a_conn.getDB(name).foo.getIndexes().length, + b_conn.getDB(name).foo.getIndexes().length, + 'Unique index not dropped during rollback: ' + tojson(b_conn.getDB(name).foo.getIndexes())); replTest.stopSet(); diff --git a/jstests/replsets/rollback_too_new.js b/jstests/replsets/rollback_too_new.js index e0a88e12f31..2e8e4d3693d 100644 --- a/jstests/replsets/rollback_too_new.js +++ b/jstests/replsets/rollback_too_new.js @@ -28,17 +28,13 @@ // get master and do an initial write var master = replTest.getPrimary(); - var options = { - writeConcern: {w: 2, wtimeout: 60000} - }; + var options = {writeConcern: {w: 2, wtimeout: 60000}}; assert.writeOK(master.getDB(name).foo.insert({x: 1}, options)); // add an oplog entry from the distant future as the most recent entry on node C var future_oplog_entry = conns[2].getDB("local").oplog.rs.find().sort({$natural: -1})[0]; future_oplog_entry["ts"] = new Timestamp(future_oplog_entry["ts"].getTime() + 200000, 1); - options = { - writeConcern: {w: 1, wtimeout: 60000} - }; + options = {writeConcern: {w: 1, wtimeout: 60000}}; assert.writeOK(conns[2].getDB("local").oplog.rs.insert(future_oplog_entry, options)); replTest.stop(CID); diff --git a/jstests/replsets/server_status_metrics.js b/jstests/replsets/server_status_metrics.js index fb7f92fe55f..05a3b4bccc0 100644 --- a/jstests/replsets/server_status_metrics.js +++ b/jstests/replsets/server_status_metrics.js @@ -56,11 +56,7 @@ assert.writeOK(bulk.execute({w: 2})); testSecondaryMetrics(secondary, 1000, secondaryBaseOplogInserts); -var options = { - writeConcern: {w: 2}, - multi: true, - upsert: true -}; +var options = {writeConcern: {w: 2}, multi: true, upsert: true}; assert.writeOK(testDB.a.update({}, {$set: {d: new Date()}}, options)); testSecondaryMetrics(secondary, 2000, secondaryBaseOplogInserts); diff --git a/jstests/replsets/stepdown3.js b/jstests/replsets/stepdown3.js index d0da019f7a1..968877a2069 100644 --- a/jstests/replsets/stepdown3.js +++ b/jstests/replsets/stepdown3.js @@ -19,9 +19,7 @@ // do another write, because the first one might be longer than 10 seconds ago // on the secondary (due to starting up), and we need to be within 10 seconds // to step down. - var options = { - writeConcern: {w: 2, wtimeout: 30000} - }; + var options = {writeConcern: {w: 2, wtimeout: 30000}}; assert.writeOK(master.getDB("test").foo.insert({x: 2}, options)); // lock secondary, to pause replication print("\nlock secondary"); diff --git a/jstests/replsets/stepdown_catch_up_opt.js b/jstests/replsets/stepdown_catch_up_opt.js index 304927a7838..48bd11adde1 100644 --- a/jstests/replsets/stepdown_catch_up_opt.js +++ b/jstests/replsets/stepdown_catch_up_opt.js @@ -26,10 +26,10 @@ var stringNotIntCode = 14; // Expect a failure with a string argument. - assert.commandFailedWithCode(primary.getDB('admin').runCommand( - {replSetStepDown: 10, secondaryCatchUpPeriodSecs: 'STR'}), - stringNotIntCode, - 'Expected string argument to secondaryCatchupPeriodSecs to fail.'); + assert.commandFailedWithCode( + primary.getDB('admin').runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 'STR'}), + stringNotIntCode, + 'Expected string argument to secondaryCatchupPeriodSecs to fail.'); // Expect a failure with a longer secondaryCatchupPeriodSecs than the stepdown period. assert.commandFailedWithCode( @@ -44,8 +44,8 @@ 'Failed to configure rsSyncApplyStop failpoint.'); function disableFailPoint() { - assert.commandWorked(secondary.getDB('admin') - .runCommand({configureFailPoint: 'rsSyncApplyStop', mode: 'off'}), + assert.commandWorked(secondary.getDB('admin').runCommand( + {configureFailPoint: 'rsSyncApplyStop', mode: 'off'}), 'Failed to disable rsSyncApplyStop failpoint.'); } @@ -60,8 +60,7 @@ jsTestLog('Try to step down.'); var startTime = new Date(); assert.commandFailedWithCode( - primary.getDB('admin') - .runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 1}), + primary.getDB('admin').runCommand({replSetStepDown: 10, secondaryCatchUpPeriodSecs: 1}), noCaughtUpSecondariesCode, 'Expected replSetStepDown to fail, since no secondaries should be caught up.'); var endTime = new Date(); diff --git a/jstests/replsets/stepdown_killop.js b/jstests/replsets/stepdown_killop.js index c5fc593239b..9185517e6c7 100644 --- a/jstests/replsets/stepdown_killop.js +++ b/jstests/replsets/stepdown_killop.js @@ -38,11 +38,11 @@ // do a write then ask the PRIMARY to stepdown jsTestLog("Initiating stepdown"); - assert.writeOK(primary.getDB(name) - .foo.insert({myDoc: true, x: 1}, {writeConcern: {w: 1, wtimeout: 60000}})); + assert.writeOK(primary.getDB(name).foo.insert({myDoc: true, x: 1}, + {writeConcern: {w: 1, wtimeout: 60000}})); var stepDownCmd = function() { - var res = db.getSiblingDB('admin') - .runCommand({replSetStepDown: 60, secondaryCatchUpPeriodSecs: 60}); + var res = db.getSiblingDB('admin').runCommand( + {replSetStepDown: 60, secondaryCatchUpPeriodSecs: 60}); assert.commandFailedWithCode(res, 11601 /*interrupted*/); }; var stepDowner = startParallelShell(stepDownCmd, primary.port); diff --git a/jstests/replsets/stepdown_long_wait_time.js b/jstests/replsets/stepdown_long_wait_time.js index 60e0fdb4247..8ef398224f2 100644 --- a/jstests/replsets/stepdown_long_wait_time.js +++ b/jstests/replsets/stepdown_long_wait_time.js @@ -32,9 +32,7 @@ 'Failed to configure rsSyncApplyStop failpoint.'); jsTestLog("do a write then ask the PRIMARY to stepdown"); - var options = { - writeConcern: {w: 1, wtimeout: 60000} - }; + var options = {writeConcern: {w: 1, wtimeout: 60000}}; assert.writeOK(primary.getDB(name).foo.insert({x: 1}, options)); var stepDownSecs = 60; var secondaryCatchUpPeriodSecs = 60; diff --git a/jstests/replsets/sync2.js b/jstests/replsets/sync2.js index 481f59a13d9..8624d913538 100644 --- a/jstests/replsets/sync2.js +++ b/jstests/replsets/sync2.js @@ -35,9 +35,7 @@ assert.soon(function() { replTest.awaitReplication(); jsTestLog("Checking that ops still replicate correctly"); -var option = { - writeConcern: {w: 5, wtimeout: 30000} -}; +var option = {writeConcern: {w: 5, wtimeout: 30000}}; // In PV0, this write can fail as a result of a bad spanning tree. If 2 was syncing from 4 prior to // bridging, it will not change sync sources and receive the write in time. This was not a problem // in 3.0 because the old version of mongobridge caused all the nodes to restart during diff --git a/jstests/replsets/tags.js b/jstests/replsets/tags.js index 55a0c4e2927..a079c4c9bb9 100644 --- a/jstests/replsets/tags.js +++ b/jstests/replsets/tags.js @@ -98,9 +98,7 @@ jsTestLog('Node ' + nodeId + ' (' + replTest.nodes[nodeId].host + ') should be primary.'); replTest.waitForState(replTest.nodes[nodeId], ReplSetTest.State.PRIMARY, 60 * 1000); primary = replTest.getPrimary(); - var writeConcern = { - writeConcern: {w: expectedWritableNodes, wtimeout: 30 * 1000} - }; + var writeConcern = {writeConcern: {w: expectedWritableNodes, wtimeout: 30 * 1000}}; assert.writeOK(primary.getDB('foo').bar.insert({x: 100}, writeConcern)); return primary; }; @@ -125,9 +123,7 @@ jsTestLog('partitions: nodes with each set of brackets [N1, N2, N3] form a complete network.'); jsTestLog('partitions: [0-1-2] [3] [4] (only nodes 0 and 1 can replicate from primary node 2'); - var doc = { - x: 1 - }; + var doc = {x: 1}; // This timeout should be shorter in duration than the server parameter maxSyncSourceLagSecs. // Some writes are expected to block for this 'timeout' duration before failing. @@ -140,9 +136,7 @@ primary = ensurePrimary(2, 3); jsTestLog('Non-existent write concern should be rejected.'); - options = { - writeConcern: {w: 'blahblah', wtimeout: timeout} - }; + options = {writeConcern: {w: 'blahblah', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); var result = assert.writeError(primary.getDB('foo').bar.insert(doc, options)); assert.neq(null, result.getWriteConcernError()); @@ -151,9 +145,7 @@ tojson(result.getWriteConcernError())); jsTestLog('Write concern "3 or 4" should fail - 3 and 4 are not connected to the primary.'); - var options = { - writeConcern: {w: '3 or 4', wtimeout: timeout} - }; + var options = {writeConcern: {w: '3 or 4', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); result = primary.getDB('foo').bar.insert(doc, options); assert.neq(null, result.getWriteConcernError()); @@ -166,16 +158,12 @@ jsTestLog('Write concern "3 or 4" should work - 4 is now connected to the primary ' + primary.host + ' via node 1 ' + replTest.nodes[1].host); - options = { - writeConcern: {w: '3 or 4', wtimeout: timeout} - }; + options = {writeConcern: {w: '3 or 4', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); jsTestLog('Write concern "3 and 4" should fail - 3 is not connected to the primary.'); - options = { - writeConcern: {w: '3 and 4', wtimeout: timeout} - }; + options = {writeConcern: {w: '3 and 4', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); result = assert.writeError(primary.getDB('foo').bar.insert(doc, options)); assert.neq(null, result.getWriteConcernError()); @@ -190,31 +178,23 @@ jsTestLog('31003 should sync from 31004 (31024)'); jsTestLog('Write concern "3 and 4" should work - ' + 'nodes 3 and 4 are connected to primary via node 1.'); - options = { - writeConcern: {w: '3 and 4', wtimeout: timeout} - }; + options = {writeConcern: {w: '3 and 4', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); jsTestLog('Write concern "2" - writes to primary only.'); - options = { - writeConcern: {w: '2', wtimeout: 0} - }; + options = {writeConcern: {w: '2', wtimeout: 0}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); jsTestLog('Write concern "1 and 2"'); - options = { - writeConcern: {w: '1 and 2', wtimeout: 0} - }; + options = {writeConcern: {w: '1 and 2', wtimeout: 0}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); jsTestLog('Write concern "2 dc and 3 server"'); primary = ensurePrimary(2, 5); - options = { - writeConcern: {w: '2 dc and 3 server', wtimeout: timeout} - }; + options = {writeConcern: {w: '2 dc and 3 server', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); @@ -239,17 +219,13 @@ primary = ensurePrimary(1, 4); jsTestLog('Write concern "3 and 4" should still work with new primary node 1 ' + primary.host); - options = { - writeConcern: {w: '3 and 4', wtimeout: timeout} - }; + options = {writeConcern: {w: '3 and 4', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); assert.writeOK(primary.getDB('foo').bar.insert(doc, options)); jsTestLog('Write concern "2" should fail because node 2 ' + replTest.nodes[2].host + ' is down.'); - options = { - writeConcern: {w: '2', wtimeout: timeout} - }; + options = {writeConcern: {w: '2', wtimeout: timeout}}; assert.writeOK(primary.getDB('foo').bar.insert(doc)); result = assert.writeError(primary.getDB('foo').bar.insert(doc, options)); assert.neq(null, result.getWriteConcernError()); diff --git a/jstests/replsets/two_initsync.js b/jstests/replsets/two_initsync.js index 1f2b526d61e..a9d47eb3ff1 100644 --- a/jstests/replsets/two_initsync.js +++ b/jstests/replsets/two_initsync.js @@ -56,10 +56,8 @@ doTest = function(signal) { var a = replTest.getPrimary().getDB("two"); for (var i = 0; i < 20000; i++) - a.coll.insert({ - i: i, - s: "a b" - }); + a.coll.insert( + {i: i, s: "a b"}); // Start a second node var second = replTest.add(); diff --git a/jstests/replsets/user_management_wc.js b/jstests/replsets/user_management_wc.js index 691a2520544..3aa186df277 100644 --- a/jstests/replsets/user_management_wc.js +++ b/jstests/replsets/user_management_wc.js @@ -132,10 +132,7 @@ load('jstests/multiVersion/libs/auth_helpers.js'); } function testValidWriteConcern(cmd) { - cmd.req.writeConcern = { - w: 'majority', - wtimeout: 25000 - }; + cmd.req.writeConcern = {w: 'majority', wtimeout: 25000}; jsTest.log("Testing " + tojson(cmd.req)); dropUsersAndRoles(); @@ -148,9 +145,7 @@ load('jstests/multiVersion/libs/auth_helpers.js'); } function testInvalidWriteConcern(cmd) { - cmd.req.writeConcern = { - w: 15 - }; + cmd.req.writeConcern = {w: 15}; jsTest.log("Testing " + tojson(cmd.req)); dropUsersAndRoles(); |