[Neo-report] r2388 vincent - in /trunk/neo/tests/functional: __init__.py testCluster.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sat Oct 30 16:05:30 CEST 2010


Author: vincent
Date: Sat Oct 30 16:05:29 2010
New Revision: 2388

Log:
Also stop clients in NEOCluster.stop.

But make it optional, as some tests might want to stop everything
except clients (stopping single processes is already possible
separately).

Modified:
    trunk/neo/tests/functional/__init__.py
    trunk/neo/tests/functional/testCluster.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] Sat Oct 30 16:05:29 2010
@@ -157,6 +157,7 @@ class NEOCluster(object):
                  cleanup_on_delete=False, temp_dir=None,
                  clear_databases=True, adapter='MySQL',
                  verbose=True):
+        self.zodb_storage_list = []
         self.cleanup_on_delete = cleanup_on_delete
         self.verbose = verbose
         self.uuid_set = set()
@@ -308,7 +309,7 @@ class NEOCluster(object):
             self.expectClusterRunning()
             neoctl.enableStorageList([x[2] for x in storage_node_list])
 
-    def stop(self):
+    def stop(self, clients=True):
         for process_list in self.process_dict.itervalues():
             for process in process_list:
                 try:
@@ -316,6 +317,10 @@ class NEOCluster(object):
                     process.wait()
                 except AlreadyStopped:
                     pass
+        if clients:
+            for zodb_storage in self.zodb_storage_list:
+                zodb_storage.close()
+            self.zodb_storage_list = []
         time.sleep(0.5)
 
     def getNEOCTL(self):
@@ -323,13 +328,15 @@ class NEOCluster(object):
 
     def getZODBStorage(self):
         master_nodes = self.master_nodes.replace('/', ' ')
-        return Storage(
+        result = Storage(
             master_nodes=master_nodes,
             name=self.cluster_name,
             connector='SocketConnector',
             logfile=os.path.join(self.temp_dir, 'client.log'),
             verbose=self.verbose,
         )
+        self.zodb_storage_list.append(result)
+        return result
 
     def getZODBConnection(self):
         """ Return a tuple with the database and a connection """

Modified: trunk/neo/tests/functional/testCluster.py
==============================================================================
--- trunk/neo/tests/functional/testCluster.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/testCluster.py [iso-8859-1] Sat Oct 30 16:05:29 2010
@@ -89,7 +89,7 @@ class ClusterTests(NEOFunctionalTest):
         db, conn = self.neo.getZODBConnection()
         conn.root()[0] = 'ok'
         transaction.commit()
-        self.neo.stop()
+        self.neo.stop(clients=False)
         # XXX: (obj|trans) become t(obj|trans)
         self.neo.switchTables('test_neo1')
         self.neo.start()





More information about the Neo-report mailing list