Commit 1887c5d7 authored by Grégory Wisniewski's avatar Grégory Wisniewski

ZODB test instanciate a neo cluster for each test to use a different temporary

directory. Do the same for the testStartWithManyPartitions and fix an unused
parameter on StorageTests.__setup().


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1247 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 775fcbb1
...@@ -46,12 +46,12 @@ class StorageTests(NEOFunctionalTest): ...@@ -46,12 +46,12 @@ class StorageTests(NEOFunctionalTest):
result = db.store_result().fetch_row()[0][0] result = db.store_result().fetch_row()[0][0]
return result return result
def __setup(self, storage_number=2, pending_number=0, replicas=1, partitions=10): def __setup(self, storage_number=2, pending_number=0, replicas=1,
partitions=10, master_node_count=2):
# create a neo cluster # create a neo cluster
self.neo = NEOCluster(['test_neo%d' % i for i in xrange(storage_number)], self.neo = NEOCluster(['test_neo%d' % i for i in xrange(storage_number)],
port_base=20000, port_base=20000, master_node_count=master_node_count,
master_node_count=2, partitions=partitions, replicas=replicas,
partitions=10, replicas=replicas,
temp_dir=self.getTempDirectory(), temp_dir=self.getTempDirectory(),
) )
self.neo.setupDB() self.neo.setupDB()
...@@ -372,18 +372,12 @@ class StorageTests(NEOFunctionalTest): ...@@ -372,18 +372,12 @@ class StorageTests(NEOFunctionalTest):
self.__checkDatabase(self.neo.db_list[1]) self.__checkDatabase(self.neo.db_list[1])
def testStartWithManyPartitions(self): def testStartWithManyPartitions(self):
neo = NEOCluster(['test_neo1'], port_base=20000, self.__setup(storage_number=2, partitions=5000, master_node_count=1)
partitions=5000, master_node_count=1) neoctl = self.neo.getNEOCTL()
neoctl = neo.getNEOCTL() # Just tests that cluster can start with more than 1000 partitions.
neo.setupDB() # 1000, because currently there is an arbitrary packet split at
neo.start() # every 1000 partition when sending a partition table.
try: self.neo.expectClusterState(protocol.RUNNING_CLUSTER_STATE)
# Just tests that cluster can start with more than 1000 partitions.
# 1000, because currently there is an arbitrary packet split at
# every 1000 partition when sending a partition table.
neo.expectClusterState(protocol.RUNNING_CLUSTER_STATE)
finally:
neo.stop()
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
...@@ -38,17 +38,17 @@ class DecoyIndependent(Persistent): ...@@ -38,17 +38,17 @@ class DecoyIndependent(Persistent):
def _p_independent(self): def _p_independent(self):
return 0 return 0
neo = NEOCluster(['test_neo1'],
partitions=1, replicas=0, port_base=20000,
master_node_count=1)
class ZODBTests(NEOFunctionalTest): class ZODBTests(NEOFunctionalTest):
def setUp(self): def setUp(self):
neo.stop()
neo.setupDB() self.neo = NEOCluster(['test_neo1'],
neo.start() partitions=1, replicas=0, port_base=20000,
self._storage = neo.getZODBStorage() master_node_count=1, temp_dir=self.getTempDirectory())
self.neo.stop()
self.neo.setupDB()
self.neo.start()
self._storage = self.neo.getZODBStorage()
self._db = ZODB.DB(self._storage) self._db = ZODB.DB(self._storage)
def populate(self): def populate(self):
...@@ -65,7 +65,7 @@ class ZODBTests(NEOFunctionalTest): ...@@ -65,7 +65,7 @@ class ZODBTests(NEOFunctionalTest):
def tearDown(self): def tearDown(self):
self._db.close() self._db.close()
self._storage.cleanup() self._storage.cleanup()
neo.stop() self.neo.stop()
def checkExportImport(self, abort_it=False): def checkExportImport(self, abort_it=False):
self.populate() self.populate()
......
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