2015-10-22 11:18:50 -04:00
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
var s = new ShardingTest({ name: "diffservers1", shards: 2 });
|
2009-02-17 10:06:02 -05:00
|
|
|
|
2009-08-29 15:08:22 -04:00
|
|
|
assert.eq( 2 , s.config.shards.count() , "server count wrong" );
|
2015-11-25 11:20:43 -05:00
|
|
|
assert.eq( 0 , s._connections[0].getDB( "config" ).shards.count() , "shouldn't be here" );
|
|
|
|
|
assert.eq( 0 , s._connections[1].getDB( "config" ).shards.count() , "shouldn't be here" );
|
2009-02-17 10:06:02 -05:00
|
|
|
|
|
|
|
|
test1 = s.getDB( "test1" ).foo;
|
|
|
|
|
test1.save( { a : 1 } );
|
|
|
|
|
test1.save( { a : 2 } );
|
|
|
|
|
test1.save( { a : 3 } );
|
2015-10-30 20:32:16 +11:00
|
|
|
assert.eq( 3 , test1.count() );
|
2009-02-17 10:06:02 -05:00
|
|
|
|
2009-09-01 14:06:50 -04:00
|
|
|
assert( ! s.admin.runCommand( { addshard: "sdd$%" } ).ok , "bad hostname" );
|
2015-10-22 11:18:50 -04:00
|
|
|
|
2015-09-01 16:19:57 -04:00
|
|
|
var portWithoutHostRunning = allocatePort();
|
|
|
|
|
assert(!s.admin.runCommand({addshard: "127.0.0.1:" + portWithoutHostRunning}).ok, "host not up");
|
|
|
|
|
assert(!s.admin.runCommand({ addshard: "10.0.0.1:" + portWithoutHostRunning}).ok,
|
|
|
|
|
"allowed shard in IP when config is localhost" );
|
2009-09-01 14:06:50 -04:00
|
|
|
|
2009-02-18 10:59:13 -05:00
|
|
|
s.stop();
|
2009-02-17 10:06:02 -05:00
|
|
|
|
2015-10-22 11:18:50 -04:00
|
|
|
})();
|