Commit d6a06f83 authored by Vincent Pelletier's avatar Vincent Pelletier

Add getPrimaryMaster, a wrapper around neoctl.getPrimaryMaster which catches NotReadyException.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1184 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 509bccf3
...@@ -77,6 +77,13 @@ class MasterTests(unittest.TestCase): ...@@ -77,6 +77,13 @@ class MasterTests(unittest.TestCase):
state = None state = None
return state return state
def getPrimaryMaster(self):
try:
current_try = self.neoctl.getPrimaryMaster()
except NotReadyException:
current_try = None
return current_try
def expectCondition(self, condition, timeout, delay): def expectCondition(self, condition, timeout, delay):
end = time() + timeout + DELAY_SAFETY_MARGIN end = time() + timeout + DELAY_SAFETY_MARGIN
opaque = None opaque = None
...@@ -111,10 +118,7 @@ class MasterTests(unittest.TestCase): ...@@ -111,10 +118,7 @@ class MasterTests(unittest.TestCase):
def expectPrimaryMaster(self, uuid=None, timeout=0, delay=1): def expectPrimaryMaster(self, uuid=None, timeout=0, delay=1):
def callback(last_try): def callback(last_try):
try: current_try = self.getPrimaryMaster()
current_try = self.neoctl.getPrimaryMaster()
except NotReadyException:
current_try = None
if None not in (uuid, current_try) and uuid != current_try: if None not in (uuid, current_try) and uuid != current_try:
raise AssertionError, 'An unexpected primary arised: %r, ' \ raise AssertionError, 'An unexpected primary arised: %r, ' \
'expected %r' % (dump(current_try), dump(uuid)) 'expected %r' % (dump(current_try), dump(uuid))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment