diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/sharding/autodiscover_config_rs_from_secondary.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/autodiscover_config_rs_from_secondary.js')
-rw-r--r-- | jstests/sharding/autodiscover_config_rs_from_secondary.js | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/jstests/sharding/autodiscover_config_rs_from_secondary.js b/jstests/sharding/autodiscover_config_rs_from_secondary.js index d0c4e84d8bd..5d7aa1f7dca 100644 --- a/jstests/sharding/autodiscover_config_rs_from_secondary.js +++ b/jstests/sharding/autodiscover_config_rs_from_secondary.js @@ -3,44 +3,44 @@ (function() { -'use strict'; - -var rst = new ReplSetTest({name : "configRS", - nodes: 3, - nodeOptions: {configsvr: "", storageEngine: "wiredTiger"}}); -rst.startSet(); -var conf = rst.getReplSetConfig(); -conf.members[1].priority = 0; -conf.members[2].priority = 0; -rst.initiate(conf); - -var seedList = rst.name + "/" + rst.nodes[1].host; // node 1 is guaranteed to not be primary -{ - // Ensure that mongos can start up when given the CSRS secondary, discover the primary, and - // perform writes to the config servers. + 'use strict'; + + var rst = new ReplSetTest( + {name: "configRS", nodes: 3, nodeOptions: {configsvr: "", storageEngine: "wiredTiger"}}); + rst.startSet(); + var conf = rst.getReplSetConfig(); + conf.members[1].priority = 0; + conf.members[2].priority = 0; + rst.initiate(conf); + + var seedList = rst.name + "/" + rst.nodes[1].host; // node 1 is guaranteed to not be primary + { + // Ensure that mongos can start up when given the CSRS secondary, discover the primary, and + // perform writes to the config servers. + var mongos = MongoRunner.runMongos({configdb: seedList}); + var admin = mongos.getDB('admin'); + assert.writeOK(admin.foo.insert({a: 1})); + assert.eq(1, admin.foo.findOne().a); + MongoRunner.stopMongos(mongos); + } + + // Wait for replication to all config server replica set members to ensure that mongos + // doesn't read from a stale config server when trying to verify if the initial cluster metadata + // has been properly written. + rst.awaitReplication(); + // Now take down the one electable node + rst.stop(0); + rst.awaitNoPrimary(); + + // Start a mongos when there is no primary var mongos = MongoRunner.runMongos({configdb: seedList}); + // Take down the one node the mongos knew about to ensure that it autodiscovered the one + // remaining + // config server + rst.stop(1); + var admin = mongos.getDB('admin'); - assert.writeOK(admin.foo.insert({a:1})); + mongos.setSlaveOk(true); assert.eq(1, admin.foo.findOne().a); - MongoRunner.stopMongos(mongos); -} - -// Wait for replication to all config server replica set members to ensure that mongos -// doesn't read from a stale config server when trying to verify if the initial cluster metadata -// has been properly written. -rst.awaitReplication(); -// Now take down the one electable node -rst.stop(0); -rst.awaitNoPrimary(); - -// Start a mongos when there is no primary -var mongos = MongoRunner.runMongos({configdb: seedList}); -// Take down the one node the mongos knew about to ensure that it autodiscovered the one remaining -// config server -rst.stop(1); - -var admin = mongos.getDB('admin'); -mongos.setSlaveOk(true); -assert.eq(1, admin.foo.findOne().a); })(); |