summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYassine Lamgarchal <yassine.lamgarchal@redhat.com>2016-07-17 02:33:47 +0200
committerYassine Lamgarchal <yassine.lamgarchal@redhat.com>2016-07-17 02:39:40 +0200
commitfcc7ea16679b4a8e7b87b7c5071d3b0d3df29531 (patch)
treee93fed906d847f9c21df610e563757cee97df115
parent324482fa96344410cec56254d61ccf91ea5e9a8b (diff)
downloadtooz-fcc7ea16679b4a8e7b87b7c5071d3b0d3df29531.tar.gz
Fix the test test_unwatch_elected_as_leader.
The test test_unwatch_elected_as_leader ensure that there is exactly one leader election hook exists after calling watch_elected_as_leader(). But the assertion actually verify that there is only one group inside the dict _hooks_elected_leader. This commit fix it by using the actual number of elected leader hooks: _hooks_elected_leader[self.group_ip]. Change-Id: If4d6192b451f495154c663151000e6071ac4e02c
-rw-r--r--tooz/tests/test_coordination.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tooz/tests/test_coordination.py b/tooz/tests/test_coordination.py
index 5e22aeb..f2181d4 100644
--- a/tooz/tests/test_coordination.py
+++ b/tooz/tests/test_coordination.py
@@ -676,7 +676,8 @@ class TestAPI(tests.TestCaseSkipNotImplemented):
self._coord.watch_elected_as_leader(self.group_id, self._set_event)
# Ensure exactly one leader election hook exists
- self.assertEqual(1, len(self._coord._hooks_elected_leader))
+ self.assertEqual(1,
+ len(self._coord._hooks_elected_leader[self.group_id]))
# Unwatch, and ensure no leader election hooks exist
self._coord.unwatch_elected_as_leader(self.group_id, self._set_event)