summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2017-01-04 17:17:48 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2017-01-04 17:18:05 -0500
commitf888e8dcce90f70d052099aecff82e62964ae3fe (patch)
treed417a09b246f369fc610f3372e70cc8c61d98e33
parent8e8af24bbf0022a7882c890eb82efa6cd853d975 (diff)
downloadmongo-f888e8dcce90f70d052099aecff82e62964ae3fe.tar.gz
SERVER-23316 Use shards from ShardingTest instead of querying config.shards for balance_repl.js
-rw-r--r--jstests/noPassthroughWithMongod/balance_repl.js23
1 files changed, 9 insertions, 14 deletions
diff --git a/jstests/noPassthroughWithMongod/balance_repl.js b/jstests/noPassthroughWithMongod/balance_repl.js
index ea2a7f87226..2972cf676f4 100644
--- a/jstests/noPassthroughWithMongod/balance_repl.js
+++ b/jstests/noPassthroughWithMongod/balance_repl.js
@@ -3,36 +3,31 @@ var s = new ShardingTest({ shards: 2, verbose: 1, other: otherOptions });
s.config.settings.update({ _id: "balancer" },
{ $set: { stopped: true }}, true );
-db = s.getDB( "test" );
-var bulk = db.foo.initializeUnorderedBulkOp();
+coll = s.s0.getCollection("test.foo");
+
+var bulk = coll.initializeUnorderedBulkOp();
for (var i = 0; i < 2100; i++) {
bulk.insert({ _id: i, x: i });
}
assert.writeOK(bulk.execute());
-serverName = s.getServerName( "test" )
-other = s.config.shards.findOne( { _id : { $ne : serverName } } );
-
-s.adminCommand( { enablesharding : "test" } )
-s.ensurePrimaryShard('test', 'test-rs0');
-s.adminCommand( { shardcollection : "test.foo" , key : { _id : 1 } } );
+s.adminCommand( { enablesharding : coll.getDB() + "" } )
+s.ensurePrimaryShard(coll.getDB() + "", s.shard0.shardName);
+s.adminCommand( { shardcollection : coll + "" , key : { _id : 1 } } );
for ( i=0; i<20; i++ )
- s.adminCommand( { split : "test.foo" , middle : { _id : i * 100 } } );
+ s.adminCommand( { split : coll + "" , middle : { _id : i * 100 } } );
-assert.eq( 2100, db.foo.find().itcount() );
-coll = db.foo;
+assert.eq( 2100, coll.find().itcount() );
coll.setSlaveOk();
-
-
for ( i=0; i<20; i++ ) {
// Needs to waitForDelete because we'll be performing a slaveOk query,
// and secondaries don't have a chunk manager so it doesn't know how to
// filter out docs it doesn't own.
s.adminCommand({ moveChunk: "test.foo",
find: { _id: i * 100 },
- to : other._id,
+ to : s.shard1.shardName,
_secondaryThrottle: true,
writeConcern: { w: 2 },
_waitForDelete: true });