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/no_empty_reset.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/no_empty_reset.js')
-rw-r--r-- | jstests/sharding/no_empty_reset.js | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/jstests/sharding/no_empty_reset.js b/jstests/sharding/no_empty_reset.js index bda63ee9edc..61fe5905cc0 100644 --- a/jstests/sharding/no_empty_reset.js +++ b/jstests/sharding/no_empty_reset.js @@ -1,63 +1,64 @@ // Tests that an empty shard can't be the cause of a chunk reset -var st = new ShardingTest({ shards : 2, mongos : 2 }); +var st = new ShardingTest({shards: 2, mongos: 2}); // Don't balance since we're manually moving chunks st.stopBalancer(); -var coll = st.s.getCollection( jsTestName() + ".coll" ); +var coll = st.s.getCollection(jsTestName() + ".coll"); -for( var i = -10; i < 10; i++ ) - coll.insert({ _id : i }); - -st.shardColl( coll, { _id : 1 }, { _id : 0 } ); +for (var i = -10; i < 10; i++) + coll.insert({_id: i}); -jsTestLog( "Sharded setup complete" ); +st.shardColl(coll, {_id: 1}, {_id: 0}); + +jsTestLog("Sharded setup complete"); st.printShardingStatus(); -jsTestLog( "Setting initial versions for each mongos..." ); +jsTestLog("Setting initial versions for each mongos..."); coll.find().itcount(); -var collB = st.s1.getCollection( "" + coll ); +var collB = st.s1.getCollection("" + coll); collB.find().itcount(); -jsTestLog( "Migrating via first mongos..." ); +jsTestLog("Migrating via first mongos..."); -var fullShard = st.getShard( coll, { _id : 1 } ); -var emptyShard = st.getShard( coll, { _id : -1 } ); +var fullShard = st.getShard(coll, {_id: 1}); +var emptyShard = st.getShard(coll, {_id: -1}); -var admin = st.s.getDB( "admin" ); +var admin = st.s.getDB("admin"); assert.soon( - function () { - var result = admin.runCommand( { moveChunk: "" + coll, - find: { _id: -1 }, - to: fullShard.shardName, - _waitForDelete: true } ); + function() { + var result = admin.runCommand({ + moveChunk: "" + coll, + find: {_id: -1}, + to: fullShard.shardName, + _waitForDelete: true + }); jsTestLog('moveChunk result = ' + tojson(result)); return result.ok; }, - "Setup FAILURE: Unable to move chunk from " + emptyShard.shardName + - " to " + fullShard.shardName -); + "Setup FAILURE: Unable to move chunk from " + emptyShard.shardName + " to " + + fullShard.shardName); -jsTestLog( "Resetting shard version via first mongos..." ); +jsTestLog("Resetting shard version via first mongos..."); coll.find().itcount(); -jsTestLog( "Making sure we don't insert into the wrong shard..." ); +jsTestLog("Making sure we don't insert into the wrong shard..."); -collB.insert({ _id : -11 }); +collB.insert({_id: -11}); -var emptyColl = emptyShard.getCollection( "" + coll ); +var emptyColl = emptyShard.getCollection("" + coll); -print( emptyColl ); -print( emptyShard ); -print( emptyShard.shardName ); +print(emptyColl); +print(emptyShard); +print(emptyShard.shardName); st.printShardingStatus(); -assert.eq( 0, emptyColl.find().itcount() ); +assert.eq(0, emptyColl.find().itcount()); jsTestLog("DONE!"); st.stop(); |