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):
result = db.store_result().fetch_row()[0][0]
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
self.neo = NEOCluster(['test_neo%d' % i for i in xrange(storage_number)],
port_base=20000,
master_node_count=2,
partitions=10, replicas=replicas,
port_base=20000, master_node_count=master_node_count,
partitions=partitions, replicas=replicas,
temp_dir=self.getTempDirectory(),
)
self.neo.setupDB()
......@@ -372,18 +372,12 @@ class StorageTests(NEOFunctionalTest):
self.__checkDatabase(self.neo.db_list[1])
def testStartWithManyPartitions(self):
neo = NEOCluster(['test_neo1'], port_base=20000,
partitions=5000, master_node_count=1)
neoctl = neo.getNEOCTL()
neo.setupDB()
neo.start()
try:
# 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()
self.__setup(storage_number=2, partitions=5000, master_node_count=1)
neoctl = self.neo.getNEOCTL()
# 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.
self.neo.expectClusterState(protocol.RUNNING_CLUSTER_STATE)
if __name__ == "__main__":
unittest.main()
......@@ -38,17 +38,17 @@ class DecoyIndependent(Persistent):
def _p_independent(self):
return 0
neo = NEOCluster(['test_neo1'],
partitions=1, replicas=0, port_base=20000,
master_node_count=1)
class ZODBTests(NEOFunctionalTest):
def setUp(self):
neo.stop()
neo.setupDB()
neo.start()
self._storage = neo.getZODBStorage()
self.neo = NEOCluster(['test_neo1'],
partitions=1, replicas=0, port_base=20000,
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)
def populate(self):
......@@ -65,7 +65,7 @@ class ZODBTests(NEOFunctionalTest):
def tearDown(self):
self._db.close()
self._storage.cleanup()
neo.stop()
self.neo.stop()
def checkExportImport(self, abort_it=False):
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