diff options
author | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-10-10 13:33:00 -0400 |
---|---|---|
committer | Esha Maharishi <esha.maharishi@mongodb.com> | 2017-10-12 13:52:20 -0400 |
commit | c617c3efabb7ee6da6ec66fe9f585dfaeed631df (patch) | |
tree | 6a5ee8a78671be4f6085e3cfdb5a4e454d70a300 /jstests/sharding/move_primary_basic.js | |
parent | c25497890b202d12b35eb153fd740af0caefa5b2 (diff) | |
download | mongo-c617c3efabb7ee6da6ec66fe9f585dfaeed631df.tar.gz |
SERVER-31008 Make trying to move the primary shard to the current primary not return an error
Diffstat (limited to 'jstests/sharding/move_primary_basic.js')
-rw-r--r-- | jstests/sharding/move_primary_basic.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/jstests/sharding/move_primary_basic.js b/jstests/sharding/move_primary_basic.js index 1fd75364f15..ab4fa9e4761 100644 --- a/jstests/sharding/move_primary_basic.js +++ b/jstests/sharding/move_primary_basic.js @@ -41,18 +41,18 @@ assert.commandFailed(mongos.adminCommand({movePrimary: 'a.b', to: shard0})); assert.commandFailed(mongos.adminCommand({movePrimary: '', to: shard0})); - // Fail if shard does not exist or empty. + // Fail if 'to' shard does not exist or empty. assert.commandFailed(mongos.adminCommand({movePrimary: kDbName, to: 'Unknown'})); assert.commandFailed(mongos.adminCommand({movePrimary: kDbName, to: ''})); assert.commandFailed(mongos.adminCommand({movePrimary: kDbName})); - // Fail if moveShard to already primary and verify metadata changes. + // Succeed if 'to' shard exists and verify metadata changes. assert.eq(shard0, mongos.getDB('config').databases.findOne({_id: kDbName}).primary); - assert.commandWorked(mongos.adminCommand({movePrimary: kDbName, to: shard1})); assert.eq(shard1, mongos.getDB('config').databases.findOne({_id: kDbName}).primary); - assert.commandFailed(mongos.adminCommand({movePrimary: kDbName, to: shard1})); + // Succeed if 'to' shard is already the primary shard for the db. + assert.commandWorked(mongos.adminCommand({movePrimary: kDbName, to: shard1})); assert.eq(shard1, mongos.getDB('config').databases.findOne({_id: kDbName}).primary); st.stop(); |