summaryrefslogtreecommitdiff
path: root/jstests/sharding/addshard2.js
diff options
context:
space:
mode:
authorDaniel Alabi <alabidan@gmail.com>2015-03-10 09:50:26 -0400
committerDaniel Alabi <alabidan@gmail.com>2015-03-10 09:50:26 -0400
commit3a0a2fae791228ac0b883c6238bf095a608e4807 (patch)
treed1a3d00959bcd4aff4f25fcfd7e0c87465a12418 /jstests/sharding/addshard2.js
parent6712a2953eb85517753219f153a7efcf21dce13c (diff)
downloadmongo-3a0a2fae791228ac0b883c6238bf095a608e4807.tar.gz
SERVER-17232 Don't return connection to config server when shardName is admin
Diffstat (limited to 'jstests/sharding/addshard2.js')
-rw-r--r--jstests/sharding/addshard2.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/sharding/addshard2.js b/jstests/sharding/addshard2.js
index aadeabf311f..811997f5485 100644
--- a/jstests/sharding/addshard2.js
+++ b/jstests/sharding/addshard2.js
@@ -20,6 +20,11 @@ var rs3 = new ReplSetTest({ 'name': 'config', nodes: 3, startPort: 31206 });
rs3.startSet();
rs3.initiate();
+// replica set with set name = 'admin'
+var rs4 = new ReplSetTest({ 'name': 'admin', nodes: 3, startPort: 31209 });
+rs4.startSet();
+rs4.initiate();
+
// step 1. name given
assert(s.admin.runCommand({"addshard" : getHostName()+":30001", "name" : "bar"}).ok, "failed to add shard in step 1");
var shard = s.getDB("config").shards.findOne({"_id" : {"$nin" : ["shard0000"]}});
@@ -66,7 +71,17 @@ assert(s.admin.runCommand({ 'addshard': configReplURI, name: 'not_config' }).ok,
shard = s.getDB('config').shards.findOne({ '_id': 'not_config' });
assert(shard, 'shard with name "not_config" not found');
+//
+// SERVER-17232 Try inserting into shard with name 'admin'
+//
+assert(s.admin.runCommand({ 'addshard': 'admin/' + getHostName() + ':31209' }).ok,
+ 'adding replica set with name "admin" should work');
+var wRes = s.getDB('test').foo.insert({ x: 1 });
+assert(!wRes.hasWriteError() && wRes.nInserted === 1,
+ 'failed to insert document into "test.foo" unsharded collection');
+
s.stop();
rs1.stopSet();
rs2.stopSet();
rs3.stopSet();
+rs4.stopSet();