Commit ee265260 authored by Vincent Pelletier's avatar Vincent Pelletier

Make testDropNodeThenRestartCluster wait for partition table changes to

become persistent.

If the storage is stopped before handling partition changed notification,
it will come back with dropped storage node as up-to-date, which is
outside the scope of this test.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1601 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7ebe221d
...@@ -106,6 +106,17 @@ class StorageTests(NEOFunctionalTest): ...@@ -106,6 +106,17 @@ class StorageTests(NEOFunctionalTest):
storage_list = self.neo.getStorageList(NodeStates.RUNNING) storage_list = self.neo.getStorageList(NodeStates.RUNNING)
self.assertEqual(len(storage_list), 2) self.assertEqual(len(storage_list), 2)
def __checkReplicateCount(self, db_name, target_count, timeout=0, delay=1):
db = self.neo.getSQLConnection(db_name)
def callback(last_try):
replicate_count = self.queryCount(db,
'select count(distinct uuid) from pt')
if last_try is not None and last_try < replicate_count:
raise AssertionError, 'Regression: %s became %s' % \
(last_try, replicate_count)
return replicate_count == target_count, replicate_count
self.neo.expectCondition(callback, timeout, delay)
def __expectRunning(self, process): def __expectRunning(self, process):
self.neo.expectStorageState(process.getUUID(), NodeStates.RUNNING) self.neo.expectStorageState(process.getUUID(), NodeStates.RUNNING)
...@@ -409,6 +420,9 @@ class StorageTests(NEOFunctionalTest): ...@@ -409,6 +420,9 @@ class StorageTests(NEOFunctionalTest):
self.__expectNotKnown(started[0]) self.__expectNotKnown(started[0])
self.__expectRunning(started[1]) self.__expectRunning(started[1])
# wait for running storage to store new partition table
self.__checkReplicateCount(self.neo.db_list[1], 1)
# restart all nodes except the dropped, it must not be known # restart all nodes except the dropped, it must not be known
self.neo.stop() self.neo.stop()
self.neo.start(except_storages=[started[0]]) self.neo.start(except_storages=[started[0]])
......
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