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/remove1.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/remove1.js')
-rw-r--r-- | jstests/sharding/remove1.js | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/jstests/sharding/remove1.js b/jstests/sharding/remove1.js index 22443aae938..8dd315ffa2a 100644 --- a/jstests/sharding/remove1.js +++ b/jstests/sharding/remove1.js @@ -1,32 +1,34 @@ (function() { -var s = new ShardingTest({ name: "remove_shard1", shards: 2 }); + var s = new ShardingTest({name: "remove_shard1", shards: 2}); -assert.eq( 2, s.config.shards.count() , "initial server count wrong" ); + assert.eq(2, s.config.shards.count(), "initial server count wrong"); -assert.writeOK(s.config.databases.insert({ _id: 'needToMove', - partitioned: false, - primary: 'shard0000'})); + assert.writeOK( + s.config.databases.insert({_id: 'needToMove', partitioned: false, primary: 'shard0000'})); -// Returns an error when trying to remove a shard that doesn't exist. -assert.commandFailed(s.admin.runCommand({ removeshard: "shardz" })); + // Returns an error when trying to remove a shard that doesn't exist. + assert.commandFailed(s.admin.runCommand({removeshard: "shardz"})); -// first remove puts in draining mode, the second tells me a db needs to move, the third actually removes -assert( s.admin.runCommand( { removeshard: "shard0000" } ).ok , "failed to start draining shard" ); -assert( !s.admin.runCommand( { removeshard: "shard0001" } ).ok , "allowed two draining shards" ); -assert.eq( s.admin.runCommand( { removeshard: "shard0000" } ).dbsToMove, ['needToMove'] , "didn't show db to move" ); -s.getDB('needToMove').dropDatabase(); -assert( s.admin.runCommand( { removeshard: "shard0000" } ).ok , "failed to remove shard" ); -assert.eq( 1, s.config.shards.count() , "removed server still appears in count" ); + // first remove puts in draining mode, the second tells me a db needs to move, the third + // actually removes + assert(s.admin.runCommand({removeshard: "shard0000"}).ok, "failed to start draining shard"); + assert(!s.admin.runCommand({removeshard: "shard0001"}).ok, "allowed two draining shards"); + assert.eq(s.admin.runCommand({removeshard: "shard0000"}).dbsToMove, + ['needToMove'], + "didn't show db to move"); + s.getDB('needToMove').dropDatabase(); + assert(s.admin.runCommand({removeshard: "shard0000"}).ok, "failed to remove shard"); + assert.eq(1, s.config.shards.count(), "removed server still appears in count"); -assert( !s.admin.runCommand( { removeshard: "shard0001" } ).ok , "allowed removing last shard" ); + assert(!s.admin.runCommand({removeshard: "shard0001"}).ok, "allowed removing last shard"); -// should create a shard0002 shard -var conn = MongoRunner.runMongod({}); -assert( s.admin.runCommand( { addshard: conn.host } ).ok, "failed to add shard" ); -assert.eq( 2, s.config.shards.count(), "new server does not appear in count" ); + // should create a shard0002 shard + var conn = MongoRunner.runMongod({}); + assert(s.admin.runCommand({addshard: conn.host}).ok, "failed to add shard"); + assert.eq(2, s.config.shards.count(), "new server does not appear in count"); -MongoRunner.stopMongod(conn); -s.stop(); + MongoRunner.stopMongod(conn); + s.stop(); })(); |