/* Startup config servers */
|
var configServers = [];
|
var configNames = [];
|
for (var i = 0; i < 3; i++) {
|
var configConf = {
|
useHostname: "localhost",
|
noJournalPrealloc: true,
|
port: 29000 + i,
|
pathOpts: { testName: "test", config: i },
|
dbpath: "$testName-config$config",
|
configsvr: ""
|
};
|
|
var conn = MongoRunner.runMongod(configConf);
|
configServers.push(conn);
|
configNames.push(conn.name);
|
}
|
|
/* Startup mongos */
|
var mongosConf = {
|
useHostname: "localhost",
|
port: 32000,
|
pathOpts: { testName: "test", mongos: 0 },
|
configdb: configNames.join(','),
|
verbose: 1
|
};
|
|
var mongos = MongoRunner.runMongos(mongosConf);
|
|
/* Test adding a replica set member as a non-repl set shard */
|
var rst2 = new ReplSetTest({ nodes: 2, smallfiles: '', noprealloc: '' });
|
rst2.startSet();
|
var cfg2 = rst2.getReplSetConfig();
|
rst2.initiate(cfg2);
|
|
res = mongos.adminCommand({ addShard: cfg2.members[1].host });
|
assert.eq(res.ok, 0, JSON.stringify(res));
|