Created
March 17, 2016 17:31
-
-
Save clayg/c807c0e17cca81a909d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/unit/common/ring/test_builder.py b/test/unit/common/ring/test_builder.py | |
index 454c6a1..c8c5023 100644 | |
--- a/test/unit/common/ring/test_builder.py | |
+++ b/test/unit/common/ring/test_builder.py | |
@@ -1385,6 +1385,21 @@ class TestRingBuilder(unittest.TestCase): | |
rb.rebalance() # this would crash since parts_wanted was not set | |
rb.validate() | |
+ def test_reduce_replicas_after_remove_device(self): | |
+ rb = ring.RingBuilder(8, 3, 1) | |
+ rb.add_dev({'id': 0, 'region': 0, 'zone': 0, 'weight': 3, | |
+ 'ip': '127.0.0.1', 'port': 10000, 'device': 'sda'}) | |
+ rb.add_dev({'id': 1, 'region': 0, 'zone': 0, 'weight': 3, | |
+ 'ip': '127.0.0.1', 'port': 10000, 'device': 'sda'}) | |
+ rb.add_dev({'id': 2, 'region': 0, 'zone': 0, 'weight': 3, | |
+ 'ip': '127.0.0.1', 'port': 10000, 'device': 'sda'}) | |
+ rb.rebalance() | |
+ rb.remove_dev(0) | |
+ self.assertRaises(exceptions.RingValidationError, rb.rebalance) | |
+ rb.set_replicas(2) | |
+ rb.rebalance() | |
+ rb.validate() | |
+ | |
def test_rebalance_post_upgrade(self): | |
rb = ring.RingBuilder(8, 3, 1) | |
# 5 devices: 5 is the smallest number that does not divide 3 * 2^8, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment