Commit a00bba1a authored by Julien Muchembled's avatar Julien Muchembled

functional tests: rename 'master_node_count' parameter to 'master_count'

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2788 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7fac1696
...@@ -228,7 +228,7 @@ class NEOProcess(object): ...@@ -228,7 +228,7 @@ class NEOProcess(object):
class NEOCluster(object): class NEOCluster(object):
def __init__(self, db_list, master_node_count=1, partitions=1, replicas=0, def __init__(self, db_list, master_count=1, partitions=1, replicas=0,
db_user='neo', db_password='neo', db_user='neo', db_password='neo',
db_super_user=DB_ADMIN, db_super_password=DB_PASSWD, db_super_user=DB_ADMIN, db_super_password=DB_PASSWD,
cleanup_on_delete=False, temp_dir=None, clear_databases=True, cleanup_on_delete=False, temp_dir=None, clear_databases=True,
...@@ -260,7 +260,7 @@ class NEOCluster(object): ...@@ -260,7 +260,7 @@ class NEOCluster(object):
admin_port = self.port_allocator.allocate(address_type, local_ip) admin_port = self.port_allocator.allocate(address_type, local_ip)
self.cluster_name = 'neo_%s' % (random.randint(0, 100), ) self.cluster_name = 'neo_%s' % (random.randint(0, 100), )
master_node_list = [self.port_allocator.allocate(address_type, local_ip) master_node_list = [self.port_allocator.allocate(address_type, local_ip)
for i in xrange(master_node_count)] for i in xrange(master_count)]
self.master_nodes = '/'.join('%s:%s' % ( self.master_nodes = '/'.join('%s:%s' % (
buildUrlFromString(self.local_ip), x, ) buildUrlFromString(self.local_ip), x, )
for x in master_node_list) for x in master_node_list)
......
...@@ -73,7 +73,7 @@ class ClientTests(NEOFunctionalTest): ...@@ -73,7 +73,7 @@ class ClientTests(NEOFunctionalTest):
self.neo = NEOCluster( self.neo = NEOCluster(
['test_neo1', 'test_neo2', 'test_neo3', 'test_neo4'], ['test_neo1', 'test_neo2', 'test_neo3', 'test_neo4'],
replicas=2, replicas=2,
master_node_count=1, master_count=1,
temp_dir=self.getTempDirectory() temp_dir=self.getTempDirectory()
) )
......
...@@ -34,7 +34,7 @@ class ClusterTests(NEOFunctionalTest): ...@@ -34,7 +34,7 @@ class ClusterTests(NEOFunctionalTest):
def testClusterBreaks(self): def testClusterBreaks(self):
self.neo = NEOCluster(['test_neo1'], self.neo = NEOCluster(['test_neo1'],
master_node_count=1, temp_dir=self.getTempDirectory()) master_count=1, temp_dir=self.getTempDirectory())
neoctl = self.neo.getNEOCTL() neoctl = self.neo.getNEOCTL()
self.neo.setupDB() self.neo.setupDB()
self.neo.start() self.neo.start()
...@@ -45,7 +45,7 @@ class ClusterTests(NEOFunctionalTest): ...@@ -45,7 +45,7 @@ class ClusterTests(NEOFunctionalTest):
def testClusterBreaksWithTwoNodes(self): def testClusterBreaksWithTwoNodes(self):
self.neo = NEOCluster(['test_neo1', 'test_neo2'], self.neo = NEOCluster(['test_neo1', 'test_neo2'],
partitions=2, master_node_count=1, replicas=0, partitions=2, master_count=1, replicas=0,
temp_dir=self.getTempDirectory()) temp_dir=self.getTempDirectory())
neoctl = self.neo.getNEOCTL() neoctl = self.neo.getNEOCTL()
self.neo.setupDB() self.neo.setupDB()
...@@ -57,7 +57,7 @@ class ClusterTests(NEOFunctionalTest): ...@@ -57,7 +57,7 @@ class ClusterTests(NEOFunctionalTest):
def testClusterDoesntBreakWithTwoNodesOneReplica(self): def testClusterDoesntBreakWithTwoNodesOneReplica(self):
self.neo = NEOCluster(['test_neo1', 'test_neo2'], self.neo = NEOCluster(['test_neo1', 'test_neo2'],
partitions=2, replicas=1, master_node_count=1, partitions=2, replicas=1, master_count=1,
temp_dir=self.getTempDirectory()) temp_dir=self.getTempDirectory())
neoctl = self.neo.getNEOCTL() neoctl = self.neo.getNEOCTL()
self.neo.setupDB() self.neo.setupDB()
...@@ -70,7 +70,7 @@ class ClusterTests(NEOFunctionalTest): ...@@ -70,7 +70,7 @@ class ClusterTests(NEOFunctionalTest):
def testElectionWithManyMasters(self): def testElectionWithManyMasters(self):
MASTER_COUNT = 20 MASTER_COUNT = 20
self.neo = NEOCluster(['test_neo1', 'test_neo2'], self.neo = NEOCluster(['test_neo1', 'test_neo2'],
partitions=10, replicas=0, master_node_count=MASTER_COUNT, partitions=10, replicas=0, master_count=MASTER_COUNT,
temp_dir=self.getTempDirectory()) temp_dir=self.getTempDirectory())
neoctl = self.neo.getNEOCTL() neoctl = self.neo.getNEOCTL()
self.neo.start() self.neo.start()
...@@ -133,7 +133,7 @@ class ClusterTests(NEOFunctionalTest): ...@@ -133,7 +133,7 @@ class ClusterTests(NEOFunctionalTest):
connection and disconnection during recovery connection and disconnection during recovery
""" """
self.neo = NEOCluster(['test_neo%d' % i for i in xrange(2)], self.neo = NEOCluster(['test_neo%d' % i for i in xrange(2)],
master_node_count=1, partitions=10, replicas=1, master_count=1, partitions=10, replicas=1,
temp_dir=self.getTempDirectory(), clear_databases=True, temp_dir=self.getTempDirectory(), clear_databases=True,
) )
storages = self.neo.getStorageProcessList() storages = self.neo.getStorageProcessList()
......
...@@ -26,7 +26,7 @@ class MasterTests(NEOFunctionalTest): ...@@ -26,7 +26,7 @@ class MasterTests(NEOFunctionalTest):
def setUp(self): def setUp(self):
NEOFunctionalTest.setUp(self) NEOFunctionalTest.setUp(self)
self.neo = NEOCluster([], master_node_count=MASTER_NODE_COUNT, self.neo = NEOCluster([], master_count=MASTER_NODE_COUNT,
temp_dir=self.getTempDirectory()) temp_dir=self.getTempDirectory())
self.neo.stop() self.neo.stop()
self.neo.start() self.neo.start()
......
...@@ -51,10 +51,10 @@ class StorageTests(NEOFunctionalTest): ...@@ -51,10 +51,10 @@ class StorageTests(NEOFunctionalTest):
return result return result
def __setup(self, storage_number=2, pending_number=0, replicas=1, def __setup(self, storage_number=2, pending_number=0, replicas=1,
partitions=10, master_node_count=2): partitions=10, master_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)],
master_node_count=master_node_count, master_count=master_count,
partitions=partitions, replicas=replicas, partitions=partitions, replicas=replicas,
temp_dir=self.getTempDirectory(), temp_dir=self.getTempDirectory(),
clear_databases=True, clear_databases=True,
...@@ -409,7 +409,7 @@ class StorageTests(NEOFunctionalTest): ...@@ -409,7 +409,7 @@ class StorageTests(NEOFunctionalTest):
""" Just tests that cluster can start with more than 1000 partitions. """ Just tests that cluster can start with more than 1000 partitions.
1000, because currently there is an arbitrary packet split at 1000, because currently there is an arbitrary packet split at
every 1000 partition when sending a partition table. """ every 1000 partition when sending a partition table. """
self.__setup(storage_number=2, partitions=5000, master_node_count=1) self.__setup(storage_number=2, partitions=5000, master_count=1)
self.neo.expectClusterState(ClusterStates.RUNNING) self.neo.expectClusterState(ClusterStates.RUNNING)
def testDropNodeThenRestartCluster(self): def testDropNodeThenRestartCluster(self):
...@@ -419,7 +419,7 @@ class StorageTests(NEOFunctionalTest): ...@@ -419,7 +419,7 @@ class StorageTests(NEOFunctionalTest):
# start with two storage / one replica # start with two storage / one replica
(started, stopped) = self.__setup(storage_number=2, replicas=1, (started, stopped) = self.__setup(storage_number=2, replicas=1,
master_node_count=1, partitions=10) master_count=1, partitions=10)
self.neo.expectRunning(started[0]) self.neo.expectRunning(started[0])
self.neo.expectRunning(started[1]) self.neo.expectRunning(started[1])
self.neo.expectOudatedCells(number=0) self.neo.expectOudatedCells(number=0)
......
...@@ -33,7 +33,7 @@ class ZODBTestCase(NEOFunctionalTest): ...@@ -33,7 +33,7 @@ class ZODBTestCase(NEOFunctionalTest):
db_list=['test_neo%d' % x for x in xrange(storages)], db_list=['test_neo%d' % x for x in xrange(storages)],
partitions=partitions, partitions=partitions,
replicas=replicas, replicas=replicas,
master_node_count=masters, master_count=masters,
temp_dir=self.getTempDirectory(), temp_dir=self.getTempDirectory(),
**cluster_kw) **cluster_kw)
self.neo.start() self.neo.start()
......
...@@ -33,7 +33,7 @@ class RecoveryTests(ZODBTestCase, StorageTestBase, RecoveryStorage): ...@@ -33,7 +33,7 @@ class RecoveryTests(ZODBTestCase, StorageTestBase, RecoveryStorage):
if not os.path.exists(dst_temp_dir): if not os.path.exists(dst_temp_dir):
os.makedirs(dst_temp_dir) os.makedirs(dst_temp_dir)
self.neo_dst = NEOCluster(['test_neo1-dst'], partitions=1, replicas=0, self.neo_dst = NEOCluster(['test_neo1-dst'], partitions=1, replicas=0,
master_node_count=1, temp_dir=dst_temp_dir) master_count=1, temp_dir=dst_temp_dir)
self.neo_dst.stop() self.neo_dst.stop()
self.neo_dst.setupDB() self.neo_dst.setupDB()
self.neo_dst.start() self.neo_dst.start()
......
...@@ -76,23 +76,21 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -76,23 +76,21 @@ class MatrixImportBenchmark(BenchmarkRunner):
datafs = 'PROD1' datafs = 'PROD1'
import random, neo.tests.stat_zodb import random, neo.tests.stat_zodb
dfs_storage = getattr(neo.tests.stat_zodb, datafs)( dfs_storage = getattr(neo.tests.stat_zodb, datafs)(
random.Random(0)).as_storage(100) random.Random(0)).as_storage(10000)
print "Import of %s with m=%s, s=%s, r=%s, p=%s" % ( print "Import of %s with m=%s, s=%s, r=%s, p=%s" % (
datafs, masters, storages, replicas, partitions) datafs, masters, storages, replicas, partitions)
# cluster if self._config.threaded:
kw = dict( from neo.tests.threaded import NEOCluster
else:
from neo.tests.functional import NEOCluster
neo = NEOCluster(
db_list=['neot_matrix_%d' % i for i in xrange(storages)], db_list=['neot_matrix_%d' % i for i in xrange(storages)],
clear_databases=True, clear_databases=True,
master_count=masters,
partitions=partitions, partitions=partitions,
replicas=replicas, replicas=replicas,
verbose=self._config.verbose, verbose=self._config.verbose,
) )
if self._config.threaded:
from neo.tests.threaded import NEOCluster
neo = NEOCluster(master_count=masters, **kw)
else:
from neo.tests.functional import NEOCluster
neo = NEOCluster(master_node_count=masters, **kw)
neo.start() neo.start()
neo_storage = neo.getZODBStorage() neo_storage = neo.getZODBStorage()
# import # import
......
...@@ -42,7 +42,7 @@ class ImportBenchmark(BenchmarkRunner): ...@@ -42,7 +42,7 @@ class ImportBenchmark(BenchmarkRunner):
clear_databases=True, clear_databases=True,
partitions=config.partitions, partitions=config.partitions,
replicas=config.replicas, replicas=config.replicas,
master_node_count=config.masters, master_count=config.masters,
verbose=False, verbose=False,
) )
......
...@@ -72,7 +72,7 @@ class ReplicationBenchmark(BenchmarkRunner): ...@@ -72,7 +72,7 @@ class ReplicationBenchmark(BenchmarkRunner):
clear_databases=True, clear_databases=True,
partitions=config.partitions, partitions=config.partitions,
replicas=1, replicas=1,
master_node_count=1, master_count=1,
verbose=False, verbose=False,
) )
neo.start() neo.start()
......
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