Commit c21ad524 authored by Julien Muchembled's avatar Julien Muchembled

Split testRestartWithMissingStorage into 1 passing and 1 failing tests

testRestartWithMissingStorage was failing randomly depending on whether the
cluster was started before or after the storage initializing connection
with the master.
Change to NEOCluster.start allows to test both scenarios explicitely.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2743 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent dcace4ee
...@@ -367,11 +367,21 @@ class NEOCluster(object): ...@@ -367,11 +367,21 @@ class NEOCluster(object):
raise AssertionError('Timeout when starting cluster') raise AssertionError('Timeout when starting cluster')
self.port_allocator.reset() self.port_allocator.reset()
def start(self, except_storages=()): def start(self, except_storages=(), delay_startup=0):
""" Do a complete start of a cluster """ """ Do a complete start of a cluster """
self.run(except_storages=except_storages) if delay_startup is None:
storage_list = self.getStorageProcessList()
self.run(except_storages=storage_list)
storage_list = set(storage_list).difference(except_storages)
else:
storage_list = ()
self.run(except_storages=except_storages)
if delay_startup:
time.sleep(delay_startup)
neoctl = self.neoctl neoctl = self.neoctl
neoctl.startCluster() neoctl.startCluster()
for storage in storage_list:
storage.start()
target_count = len(self.db_list) - len(except_storages) target_count = len(self.db_list) - len(except_storages)
storage_node_list = [] storage_node_list = []
def test(): def test():
......
...@@ -474,7 +474,7 @@ class StorageTests(NEOFunctionalTest): ...@@ -474,7 +474,7 @@ class StorageTests(NEOFunctionalTest):
self.neo.expectStorageNotKnown(started[0]) self.neo.expectStorageNotKnown(started[0])
self.neo.expectPending(stopped[0]) self.neo.expectPending(stopped[0])
def testRestartWithMissingStorage(self): def testRestartWithMissingStorage(self, fast_startup=False):
# start a cluster with a replica # start a cluster with a replica
(started, stopped) = self.__setup(storage_number=2, replicas=1, (started, stopped) = self.__setup(storage_number=2, replicas=1,
pending_number=0, partitions=10) pending_number=0, partitions=10)
...@@ -486,11 +486,15 @@ class StorageTests(NEOFunctionalTest): ...@@ -486,11 +486,15 @@ class StorageTests(NEOFunctionalTest):
self.neo.stop() self.neo.stop()
# restart it with one storage only # restart it with one storage only
self.neo.start(except_storages=(started[1], )) self.neo.start(except_storages=started[1:],
delay_startup=not fast_startup and 1 or None)
self.neo.expectRunning(started[0]) self.neo.expectRunning(started[0])
self.neo.expectUnknown(started[1]) self.neo.expectUnknown(started[1])
self.neo.expectClusterRunning() self.neo.expectClusterRunning()
def testRestartWithMissingStorageFastStartup(self):
self.testRestartWithMissingStorage(True)
def testRecoveryWithMultiplePT(self): def testRecoveryWithMultiplePT(self):
# start a cluster with 2 storages and a replica # start a cluster with 2 storages and a replica
(started, stopped) = self.__setup(storage_number=2, replicas=1, (started, stopped) = self.__setup(storage_number=2, replicas=1,
......
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