summaryrefslogtreecommitdiff
path: root/jstests/replsets/no_chaining.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/replsets/no_chaining.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/replsets/no_chaining.js')
-rw-r--r--jstests/replsets/no_chaining.js53
1 files changed, 21 insertions, 32 deletions
diff --git a/jstests/replsets/no_chaining.js b/jstests/replsets/no_chaining.js
index 88bbe7a78d0..ad086c72f9a 100644
--- a/jstests/replsets/no_chaining.js
+++ b/jstests/replsets/no_chaining.js
@@ -1,47 +1,39 @@
-function myprint( x ) {
- print( "chaining output: " + x );
+function myprint(x) {
+ print("chaining output: " + x);
}
var replTest = new ReplSetTest({name: 'testSet', nodes: 3, useBridge: true});
var nodes = replTest.startSet();
var hostnames = replTest.nodeList();
-replTest.initiate(
- {
- "_id" : "testSet",
- "members" : [
- {"_id" : 0, "host" : hostnames[0], priority: 2},
- {"_id" : 1, "host" : hostnames[1], priority: 0},
- {"_id" : 2, "host" : hostnames[2], priority: 0}
- ],
- "settings" : {
- "chainingAllowed" : false
- }
- }
-);
+replTest.initiate({
+ "_id": "testSet",
+ "members": [
+ {"_id": 0, "host": hostnames[0], priority: 2},
+ {"_id": 1, "host": hostnames[1], priority: 0},
+ {"_id": 2, "host": hostnames[2], priority: 0}
+ ],
+ "settings": {"chainingAllowed": false}
+});
var master = replTest.getPrimary();
replTest.awaitReplication();
-
var breakNetwork = function() {
nodes[0].disconnect(nodes[2]);
master = replTest.getPrimary();
};
var checkNoChaining = function() {
- master.getDB("test").foo.insert({x:1});
+ master.getDB("test").foo.insert({x: 1});
- assert.soon(
- function() {
- return nodes[1].getDB("test").foo.findOne() != null;
- }
- );
+ assert.soon(function() {
+ return nodes[1].getDB("test").foo.findOne() != null;
+ });
- var endTime = (new Date()).getTime()+10000;
+ var endTime = (new Date()).getTime() + 10000;
while ((new Date()).getTime() < endTime) {
- assert(nodes[2].getDB("test").foo.findOne() == null,
- 'Check that 2 does not catch up');
+ assert(nodes[2].getDB("test").foo.findOne() == null, 'Check that 2 does not catch up');
}
};
@@ -53,13 +45,10 @@ var forceSync = function() {
config = nodes[2].getDB("local").system.replset.findOne();
}
var targetHost = config.members[1].host;
- printjson(nodes[2].getDB("admin").runCommand({replSetSyncFrom : targetHost}));
- assert.soon(
- function() {
- return nodes[2].getDB("test").foo.findOne() != null;
- },
- 'Check for data after force sync'
- );
+ printjson(nodes[2].getDB("admin").runCommand({replSetSyncFrom: targetHost}));
+ assert.soon(function() {
+ return nodes[2].getDB("test").foo.findOne() != null;
+ }, 'Check for data after force sync');
};
// SERVER-12922