Commit 7ea5ba41 authored by Vincent Pelletier's avatar Vincent Pelletier

Use self.getPrimaryMaster.

Add extra checks when stopping primary master: now check that current primary master is None before expecting a new one to appear.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1185 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent d6a06f83
...@@ -148,10 +148,11 @@ class MasterTests(unittest.TestCase): ...@@ -148,10 +148,11 @@ class MasterTests(unittest.TestCase):
uuid = killed_uuid_list[0] uuid = killed_uuid_list[0]
# Check the state of the primary we just killed # Check the state of the primary we just killed
self.expectMasterState(uuid, (None, protocol.UNKNOWN_STATE)) self.expectMasterState(uuid, (None, protocol.UNKNOWN_STATE))
self.assertEqual(self.getPrimaryMaster(), None)
# Check that a primary master arised. # Check that a primary master arised.
self.expectPrimaryMaster(timeout=10) self.expectPrimaryMaster(timeout=10)
# Check that the uuid really changed. # Check that the uuid really changed.
new_uuid = self.neoctl.getPrimaryMaster() new_uuid = self.getPrimaryMaster()
self.assertNotEqual(new_uuid, uuid) self.assertNotEqual(new_uuid, uuid)
def testStoppingPrimaryMasterWithOneSecondary(self): def testStoppingPrimaryMasterWithOneSecondary(self):
...@@ -170,10 +171,11 @@ class MasterTests(unittest.TestCase): ...@@ -170,10 +171,11 @@ class MasterTests(unittest.TestCase):
uuid = killed_uuid_list[0] uuid = killed_uuid_list[0]
# Check the state of the primary we just killed # Check the state of the primary we just killed
self.expectMasterState(uuid, (None, protocol.UNKNOWN_STATE)) self.expectMasterState(uuid, (None, protocol.UNKNOWN_STATE))
self.assertEqual(self.getPrimaryMaster(), None)
# Check that a primary master arised. # Check that a primary master arised.
self.expectPrimaryMaster(timeout=10) self.expectPrimaryMaster(timeout=10)
# Check that the uuid really changed. # Check that the uuid really changed.
new_uuid = self.neoctl.getPrimaryMaster() new_uuid = self.getPrimaryMaster()
self.assertNotEqual(new_uuid, uuid) self.assertNotEqual(new_uuid, uuid)
def testMasterSequentialStart(self): def testMasterSequentialStart(self):
...@@ -196,7 +198,7 @@ class MasterTests(unittest.TestCase): ...@@ -196,7 +198,7 @@ class MasterTests(unittest.TestCase):
# Check that the second master is running under his known UUID. # Check that the second master is running under his known UUID.
self.expectMasterState(second_master.getUUID(), protocol.RUNNING_STATE) self.expectMasterState(second_master.getUUID(), protocol.RUNNING_STATE)
# Check that the primary master didn't change. # Check that the primary master didn't change.
self.assertEqual(self.neoctl.getPrimaryMaster(), first_master_uuid) self.assertEqual(self.getPrimaryMaster(), first_master_uuid)
# Start a third master. # Start a third master.
third_master = master_list[2] third_master = master_list[2]
...@@ -204,7 +206,7 @@ class MasterTests(unittest.TestCase): ...@@ -204,7 +206,7 @@ class MasterTests(unittest.TestCase):
# Check that the third master is running under his known UUID. # Check that the third master is running under his known UUID.
self.expectMasterState(third_master.getUUID(), protocol.RUNNING_STATE) self.expectMasterState(third_master.getUUID(), protocol.RUNNING_STATE)
# Check that the primary master didn't change. # Check that the primary master didn't change.
self.assertEqual(self.neoctl.getPrimaryMaster(), first_master_uuid) self.assertEqual(self.getPrimaryMaster(), first_master_uuid)
def test_suite(): def test_suite():
return unittest.makeSuite(MasterTests) return unittest.makeSuite(MasterTests)
......
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