2011-10-13 17:43:35 -04:00
|
|
|
// Test of complex sharding initialization
|
|
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
function shardingTestUsingObjects() {
|
|
|
|
|
var st = new ShardingTest( {
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2013-08-24 21:13:42 -04:00
|
|
|
mongos : { s0 : { verbose : 6 }, s1 : { verbose : 5 } },
|
|
|
|
|
config : { c0 : { verbose : 4 } },
|
|
|
|
|
shards : { d0 : { verbose : 3 },
|
2012-04-28 20:22:32 -04:00
|
|
|
rs1 : {
|
2013-08-24 21:13:42 -04:00
|
|
|
nodes : { d0 : { verbose : 2 },
|
|
|
|
|
a1 : { verbose : 1 } } }
|
2012-04-28 20:22:32 -04:00
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
var s0 = st.s0;
|
|
|
|
|
assert.eq( s0, st._mongos[0] );
|
|
|
|
|
|
|
|
|
|
var s1 = st.s1;
|
|
|
|
|
assert.eq( s1, st._mongos[1] );
|
|
|
|
|
|
|
|
|
|
var c0 = st.c0;
|
|
|
|
|
assert.eq( c0, st._configServers[0] );
|
|
|
|
|
|
|
|
|
|
var d0 = st.d0;
|
2015-11-25 11:20:43 -05:00
|
|
|
assert.eq( d0, st._connections[0] );
|
2012-04-28 20:22:32 -04:00
|
|
|
|
|
|
|
|
var rs1 = st.rs1;
|
|
|
|
|
assert.eq( rs1, st._rsObjects[1] );
|
|
|
|
|
|
|
|
|
|
var rs1_d0 = rs1.nodes[0];
|
|
|
|
|
var rs1_a1 = rs1.nodes[1];
|
|
|
|
|
|
2013-08-24 21:13:42 -04:00
|
|
|
assert.contains( "-vvvvvv", s0.commandLine );
|
|
|
|
|
assert.contains( "-vvvvv", s1.commandLine );
|
|
|
|
|
assert.contains( "-vvvv", c0.commandLine );
|
|
|
|
|
assert.contains( "-vvv", d0.commandLine );
|
|
|
|
|
assert.contains( "-vv", rs1_d0.commandLine );
|
|
|
|
|
assert.contains( "-v", rs1_a1.commandLine );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
st.stop();
|
|
|
|
|
}
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
function shardingTestUsingArrays() {
|
|
|
|
|
var st = new ShardingTest( {
|
2013-08-24 21:13:42 -04:00
|
|
|
mongos : [{ verbose : 5 }, { verbose : 4 } ],
|
2012-04-28 20:22:32 -04:00
|
|
|
config : [{ verbose : 3 }],
|
2013-08-24 21:13:42 -04:00
|
|
|
shards : [{ verbose : 2 }, { verbose : 1 } ]
|
2012-04-28 20:22:32 -04:00
|
|
|
});
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
var s0 = st.s0;
|
|
|
|
|
assert.eq( s0, st._mongos[0] );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
var s1 = st.s1;
|
|
|
|
|
assert.eq( s1, st._mongos[1] );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
var c0 = st.c0;
|
|
|
|
|
assert.eq( c0, st._configServers[0] );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
var d0 = st.d0;
|
2015-11-25 11:20:43 -05:00
|
|
|
assert.eq( d0, st._connections[0] );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
var d1 = st.d1;
|
2015-11-25 11:20:43 -05:00
|
|
|
assert.eq( d1, st._connections[1] );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2013-08-24 21:13:42 -04:00
|
|
|
assert.contains( "-vvvvv", s0.commandLine );
|
|
|
|
|
assert.contains( "-vvvv", s1.commandLine );
|
2012-04-28 20:22:32 -04:00
|
|
|
assert.contains( "-vvv", c0.commandLine );
|
2013-08-24 21:13:42 -04:00
|
|
|
assert.contains( "-vv", d0.commandLine );
|
|
|
|
|
assert.contains( "-v", d1.commandLine );
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
st.stop();
|
|
|
|
|
}
|
2011-10-13 17:43:35 -04:00
|
|
|
|
2012-04-28 20:22:32 -04:00
|
|
|
shardingTestUsingObjects();
|
|
|
|
|
shardingTestUsingArrays();
|
2011-10-13 17:43:35 -04:00
|
|
|
|