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/migration_failure.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/migration_failure.js')
-rw-r--r-- | jstests/sharding/migration_failure.js | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/jstests/sharding/migration_failure.js b/jstests/sharding/migration_failure.js index 0b9c950908b..97ab7ddf967 100644 --- a/jstests/sharding/migration_failure.js +++ b/jstests/sharding/migration_failure.js @@ -1,20 +1,20 @@ // -// Tests that migration failures before and after commit correctly roll back +// Tests that migration failures before and after commit correctly roll back // when possible // -var st = new ShardingTest({ shards : 2, mongos : 1 }); +var st = new ShardingTest({shards: 2, mongos: 1}); st.stopBalancer(); var mongos = st.s0; -var admin = mongos.getDB( "admin" ); -var shards = mongos.getCollection( "config.shards" ).find().toArray(); -var coll = mongos.getCollection( "foo.bar" ); +var admin = mongos.getDB("admin"); +var shards = mongos.getCollection("config.shards").find().toArray(); +var coll = mongos.getCollection("foo.bar"); -assert( admin.runCommand({ enableSharding : coll.getDB() + "" }).ok ); -printjson( admin.runCommand({ movePrimary : coll.getDB() + "", to : shards[0]._id }) ); -assert( admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }).ok ); -assert( admin.runCommand({ split : coll + "", middle : { _id : 0 } }).ok ); +assert(admin.runCommand({enableSharding: coll.getDB() + ""}).ok); +printjson(admin.runCommand({movePrimary: coll.getDB() + "", to: shards[0]._id})); +assert(admin.runCommand({shardCollection: coll + "", key: {_id: 1}}).ok); +assert(admin.runCommand({split: coll + "", middle: {_id: 0}}).ok); st.printShardingStatus(); @@ -23,58 +23,46 @@ jsTest.log("Testing failed migrations..."); var version = null; var failVersion = null; -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failMigrationCommit', mode : 'alwaysOn' })); +assert.commandWorked(st.shard0.getDB("admin").runCommand( + {configureFailPoint: 'failMigrationCommit', mode: 'alwaysOn'})); -version = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +version = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); -assert.commandFailed( admin.runCommand({ moveChunk : coll + "", - find : { _id : 0 }, - to : shards[1]._id }) ); +assert.commandFailed(admin.runCommand({moveChunk: coll + "", find: {_id: 0}, to: shards[1]._id})); -failVersion = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +failVersion = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failMigrationCommit', mode : 'off' })); +assert.commandWorked(st.shard0.getDB("admin") + .runCommand({configureFailPoint: 'failMigrationCommit', mode: 'off'})); -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failMigrationConfigWritePrepare', mode : 'alwaysOn' })); +assert.commandWorked(st.shard0.getDB("admin").runCommand( + {configureFailPoint: 'failMigrationConfigWritePrepare', mode: 'alwaysOn'})); -version = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +version = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); -assert.commandFailed( admin.runCommand({ moveChunk : coll + "", - find : { _id : 0 }, - to : shards[1]._id }) ); +assert.commandFailed(admin.runCommand({moveChunk: coll + "", find: {_id: 0}, to: shards[1]._id})); -failVersion = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +failVersion = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); assert.eq(version.global, failVersion.global); -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failMigrationConfigWritePrepare', mode : 'off' })); +assert.commandWorked(st.shard0.getDB("admin").runCommand( + {configureFailPoint: 'failMigrationConfigWritePrepare', mode: 'off'})); -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failApplyChunkOps', mode : 'alwaysOn' })); +assert.commandWorked(st.shard0.getDB("admin") + .runCommand({configureFailPoint: 'failApplyChunkOps', mode: 'alwaysOn'})); -version = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +version = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); -assert.commandWorked( admin.runCommand({ moveChunk : coll + "", - find : { _id : 0 }, - to : shards[1]._id }) ); +assert.commandWorked(admin.runCommand({moveChunk: coll + "", find: {_id: 0}, to: shards[1]._id})); -failVersion = st.shard0.getDB("admin").runCommand({ getShardVersion : coll.toString() }); +failVersion = st.shard0.getDB("admin").runCommand({getShardVersion: coll.toString()}); assert.neq(version.global, failVersion.global); -assert.commandWorked( - st.shard0.getDB("admin").runCommand({ - configureFailPoint : 'failApplyChunkOps', mode : 'off' })); +assert.commandWorked(st.shard0.getDB("admin") + .runCommand({configureFailPoint: 'failApplyChunkOps', mode: 'off'})); -jsTest.log( "DONE!" ); +jsTest.log("DONE!"); st.stop(); |