diff options
Diffstat (limited to 'jstests/sharding/ssv_config_check.js')
-rw-r--r-- | jstests/sharding/ssv_config_check.js | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/jstests/sharding/ssv_config_check.js b/jstests/sharding/ssv_config_check.js index cba03476cb0..48d7f2eac70 100644 --- a/jstests/sharding/ssv_config_check.js +++ b/jstests/sharding/ssv_config_check.js @@ -3,46 +3,46 @@ * replica set name, but with a member list that is not strictly the same. */ (function() { - "use strict"; +"use strict"; - var st = new ShardingTest({shards: 1}); +var st = new ShardingTest({shards: 1}); - var testDB = st.s.getDB('test'); - testDB.adminCommand({enableSharding: 'test'}); - testDB.adminCommand({shardCollection: 'test.user', key: {x: 1}}); +var testDB = st.s.getDB('test'); +testDB.adminCommand({enableSharding: 'test'}); +testDB.adminCommand({shardCollection: 'test.user', key: {x: 1}}); - testDB.user.insert({x: 1}); +testDB.user.insert({x: 1}); - var directConn = new Mongo(st.rs0.getPrimary().host); - var adminDB = directConn.getDB('admin'); +var directConn = new Mongo(st.rs0.getPrimary().host); +var adminDB = directConn.getDB('admin'); - var configStr = adminDB.runCommand({getShardVersion: 'test.user'}).configServer; - var alternateConfigStr = configStr.substring(0, configStr.lastIndexOf(',')); +var configStr = adminDB.runCommand({getShardVersion: 'test.user'}).configServer; +var alternateConfigStr = configStr.substring(0, configStr.lastIndexOf(',')); - var shardDoc = st.s.getDB('config').shards.findOne(); +var shardDoc = st.s.getDB('config').shards.findOne(); - jsTest.log("Verify that the obsolete init form of setShardVersion succeeds on shards."); - assert.commandWorked(adminDB.runCommand({ - setShardVersion: '', - init: true, - authoritative: true, - configdb: alternateConfigStr, - shard: shardDoc._id, - shardHost: shardDoc.host - })); +jsTest.log("Verify that the obsolete init form of setShardVersion succeeds on shards."); +assert.commandWorked(adminDB.runCommand({ + setShardVersion: '', + init: true, + authoritative: true, + configdb: alternateConfigStr, + shard: shardDoc._id, + shardHost: shardDoc.host +})); - var configAdmin = st.c0.getDB('admin'); +var configAdmin = st.c0.getDB('admin'); - jsTest.log("Verify that setShardVersion fails on the config server"); - // Even if shardName sent is 'config' and connstring sent is config server's actual connstring. - assert.commandFailedWithCode(configAdmin.runCommand({ - setShardVersion: '', - init: true, - authoritative: true, - configdb: configStr, - shard: 'config' - }), - ErrorCodes.NoShardingEnabled); +jsTest.log("Verify that setShardVersion fails on the config server"); +// Even if shardName sent is 'config' and connstring sent is config server's actual connstring. +assert.commandFailedWithCode(configAdmin.runCommand({ + setShardVersion: '', + init: true, + authoritative: true, + configdb: configStr, + shard: 'config' +}), + ErrorCodes.NoShardingEnabled); - st.stop(); +st.stop(); })(); |