diff options
| author | gord chung <gord@live.ca> | 2017-03-24 14:25:25 +0000 |
|---|---|---|
| committer | gordon chung <gord@live.ca> | 2017-03-27 22:09:25 +0000 |
| commit | 605168c9b8d6ebacff4c1e1753112b1780082707 (patch) | |
| tree | 485971fb9c560493a3eb0d6844f8185443ba9fe3 /tooz/tests | |
| parent | 3994c470d390060fbc90bb69e8d888085743bd2b (diff) | |
| download | tooz-605168c9b8d6ebacff4c1e1753112b1780082707.tar.gz | |
add weight tests for add_nodes
add test to validate all nodes are given equal weight when using
add_nodes. also, add a note to explicitly mention how it functions
Change-Id: Id6e3b72a8ad09f183cb45a1f51f9cded1c1b57a8
Diffstat (limited to 'tooz/tests')
| -rw-r--r-- | tooz/tests/test_hashring.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tooz/tests/test_hashring.py b/tooz/tests/test_hashring.py index a5a9cbb..c1407bd 100644 --- a/tooz/tests/test_hashring.py +++ b/tooz/tests/test_hashring.py @@ -91,6 +91,17 @@ class HashRingTestCase(testcase.TestCase): self.assertEqual(nodes, set(ring.nodes.keys())) self.assertEqual(2 ** 5 * 12, len(ring)) + def test_add_nodes_weight(self): + nodes = {'foo', 'bar'} + ring = hashring.HashRing(nodes) + self.assertEqual(nodes, set(ring.nodes.keys())) + self.assertEqual(2 ** 5 * len(nodes), len(ring)) + nodes.add('baz') + nodes.add('baz2') + ring.add_nodes(set(['baz', 'baz2']), weight=10) + self.assertEqual(nodes, set(ring.nodes.keys())) + self.assertEqual(2 ** 5 * 22, len(ring)) + def test_remove_node(self): nodes = {'foo', 'bar'} ring = hashring.HashRing(nodes) |
