[Neo-report] r2743 jm - in /trunk/neo/tests/functional: __init__.py testStorage.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 28 21:47:05 CEST 2011


Author: jm
Date: Thu Apr 28 21:47:05 2011
New Revision: 2743

Log:
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.

Modified:
    trunk/neo/tests/functional/__init__.py
    trunk/neo/tests/functional/testStorage.py

Modified: trunk/neo/tests/functional/__init__.py
==============================================================================
--- trunk/neo/tests/functional/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/__init__.py [iso-8859-1] Thu Apr 28 21:47:05 2011
@@ -367,11 +367,21 @@ class NEOCluster(object):
             raise AssertionError('Timeout when starting cluster')
         self.port_allocator.reset()
 
-    def start(self, except_storages=()):
+    def start(self, except_storages=(), delay_startup=0):
         """ 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.startCluster()
+        for storage in storage_list:
+            storage.start()
         target_count = len(self.db_list) - len(except_storages)
         storage_node_list = []
         def test():

Modified: trunk/neo/tests/functional/testStorage.py
==============================================================================
--- trunk/neo/tests/functional/testStorage.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/testStorage.py [iso-8859-1] Thu Apr 28 21:47:05 2011
@@ -474,7 +474,7 @@ class StorageTests(NEOFunctionalTest):
         self.neo.expectStorageNotKnown(started[0])
         self.neo.expectPending(stopped[0])
 
-    def testRestartWithMissingStorage(self):
+    def testRestartWithMissingStorage(self, fast_startup=False):
         # start a cluster with a replica
         (started, stopped) = self.__setup(storage_number=2, replicas=1,
                 pending_number=0, partitions=10)
@@ -486,11 +486,15 @@ class StorageTests(NEOFunctionalTest):
         self.neo.stop()
 
         # 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.expectUnknown(started[1])
         self.neo.expectClusterRunning()
 
+    def testRestartWithMissingStorageFastStartup(self):
+        self.testRestartWithMissingStorage(True)
+
     def testRecoveryWithMultiplePT(self):
         # start a cluster with 2 storages and a replica
         (started, stopped) = self.__setup(storage_number=2, replicas=1,




More information about the Neo-report mailing list