diff options
author | Spencer T Brody <spencer@mongodb.com> | 2015-07-31 12:56:02 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2015-08-03 11:48:18 -0400 |
commit | 998705d2c46512803400161fdac14bfca1cc5087 (patch) | |
tree | 370bf5ad0aa62fddf65fa714b97abedd8e0a06ce /jstests/sharding/addshard2.js | |
parent | e8b4e57b8d399e50b7f9202e1739f188dadf9bfb (diff) | |
download | mongo-998705d2c46512803400161fdac14bfca1cc5087.tar.gz |
SERVER-19545 Prohibit config server replica sets from being added as shards
Diffstat (limited to 'jstests/sharding/addshard2.js')
-rw-r--r-- | jstests/sharding/addshard2.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/jstests/sharding/addshard2.js b/jstests/sharding/addshard2.js index d6487c6d366..dab39ec4240 100644 --- a/jstests/sharding/addshard2.js +++ b/jstests/sharding/addshard2.js @@ -25,6 +25,15 @@ var rs4 = new ReplSetTest({ 'name': 'admin', nodes: 3, startPort: 31209 }); rs4.startSet(); rs4.initiate(); +// replica set with configServer: true should *not* be allowed to be added as a shard +var rs5 = new ReplSetTest({ 'name': 'csrs', nodes: 3, startPort: 31212 }); +rs5.startSet(); +var conf = rs5.getReplSetConfig(); +conf.configServer = true; +conf.settings = {protocolVersion: 1}; +rs5.initiate(conf); + + // step 1. name given assert(s.admin.runCommand({"addshard" : getHostName()+":" + conn1.port, "name" : "bar"}).ok, "failed to add shard in step 1"); @@ -82,8 +91,12 @@ var wRes = s.getDB('test').foo.insert({ x: 1 }); assert(!wRes.hasWriteError() && wRes.nInserted === 1, 'failed to insert document into "test.foo" unsharded collection'); +// SERVER-19545 Should not be able to add config server replsets as shards. +assert.commandFailed(s.admin.runCommand({addshard: rs5.getURL()})); + s.stop(); rs1.stopSet(); rs2.stopSet(); rs3.stopSet(); rs4.stopSet(); +rs5.stopSet();
\ No newline at end of file |