summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddharth Singh <singhsiddharth@gmail.com>2012-05-30 12:21:46 -0400
committerSiddharth Singh <singhsiddharth@gmail.com>2012-05-30 13:26:47 -0400
commitd4db8209e94433281c9c27adca26bb8846ab186b (patch)
tree77e68deeb68f25ac2bd3bc6cc07231aa15b3c535
parent62a5882e24d1ff5d8f70854f03b78f0ee8fac6d6 (diff)
downloadmongo-d4db8209e94433281c9c27adca26bb8846ab186b.tar.gz
SERVER-5962 Move primary shard before running test
result.remaining has no properties
-rw-r--r--jstests/sharding/auth_add_shard.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/jstests/sharding/auth_add_shard.js b/jstests/sharding/auth_add_shard.js
index a3caa513c6f..108e844533f 100644
--- a/jstests/sharding/auth_add_shard.js
+++ b/jstests/sharding/auth_add_shard.js
@@ -66,7 +66,9 @@ var db = mongos.getDB("foo");
var collA = mongos.getCollection("foo.bar")
// enable sharding on a collection
-admin.runCommand( { enableSharding : "" + collA.getDB() } )
+printjson( admin.runCommand( { enableSharding : "" + collA.getDB() } ) )
+printjson( admin.runCommand( { movePrimary : "foo", to : "shard0000" } ) );
+
admin.runCommand( { shardCollection : "" + collA, key : { _id : 1 } } )
// add data to the sharded collection
@@ -75,7 +77,7 @@ for (i=0; i<4; i++) {
printjson(admin.runCommand( { split : "" + collA, middle : { _id : i } }) )
}
// move a chunk
-printjson( admin.runCommand( { moveChunk : "foo.bar", find : { _id : 1 }, to : "shard0000" }) )
+printjson( admin.runCommand( { moveChunk : "foo.bar", find : { _id : 1 }, to : "shard0001" }) )
//verify the chunk was moved
admin.runCommand( { flushRouterConfig : 1 } )
@@ -95,14 +97,9 @@ assert.eq(result.ok, 1, "failed to start draining shard");
assert.soon(function() {
var result = admin.runCommand( {removeShard : getHostName() + ":" + conn.port} );
printjson(result);
- return result.ok && result.remaining.chunks == 0
+ return result.ok && result.state == "completed"
}, "failed to drain shard completely", 5 * 60 * 1000)
-// drop the database, now run remove shard again and make sure it was removed
-mongos.getDB("foo").dropDatabase();
-var result = admin.runCommand( {removeShard : getHostName() + ":" + conn.port} );
-printjson(result);
-assert.eq(result.ok, 1, "failed to remove shard");
assert.eq( 1, st.config.shards.count() , "removed server still appears in count" );
MongoRunner.stopMongod( conn );