summaryrefslogtreecommitdiff
path: root/jstests/sharding/remove1.js
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2011-09-13 18:54:38 -0400
committerMathias Stearn <mathias@10gen.com>2011-09-13 18:54:38 -0400
commit75f2d53c1f0667e9b5cfab2ecfe71e22f1d6742d (patch)
treea5e55aceba49328ff47f012a28e471b629372ea3 /jstests/sharding/remove1.js
parentfc49bf2a20cda1dc107f20ce857f24ab8930f5be (diff)
downloadmongo-75f2d53c1f0667e9b5cfab2ecfe71e22f1d6742d.tar.gz
Prevent removeShard command from putting cluster into bad state SERVER-3318
Diffstat (limited to 'jstests/sharding/remove1.js')
-rw-r--r--jstests/sharding/remove1.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/jstests/sharding/remove1.js b/jstests/sharding/remove1.js
index 9593bdf9acd..facc24e467a 100644
--- a/jstests/sharding/remove1.js
+++ b/jstests/sharding/remove1.js
@@ -4,13 +4,16 @@ assert.eq( 2, s.config.shards.count() , "initial server count wrong" );
// first remove puts in draining mode, the second actually removes
assert( s.admin.runCommand( { removeshard: "shard0000" } ).ok , "failed to start draining shard" );
+assert( !s.admin.runCommand( { removeshard: "shard0001" } ).ok , "allowed two draining shards" );
assert( s.admin.runCommand( { removeshard: "shard0000" } ).ok , "failed to remove shard" );
assert.eq( 1, s.config.shards.count() , "removed server still appears in count" );
+assert( !s.admin.runCommand( { removeshard: "shard0001" } ).ok , "allowed removing last shard" );
+
// should create a shard0002 shard
conn = startMongodTest( 29000 );
assert( s.admin.runCommand( { addshard: "localhost:29000" } ).ok, "failed to add shard" );
assert.eq( 2, s.config.shards.count(), "new server does not appear in count" );
stopMongod( 29000 );
-s.stop(); \ No newline at end of file
+s.stop();