[Erp5-report] r45591 seb - in /erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5: ...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 20 14:49:31 CEST 2011
Author: seb
Date: Wed Apr 20 14:49:31 2011
New Revision: 45591
URL: http://svn.erp5.org?rev=45591&view=rev
Log:
install runTestSuite command when installing erp5 in order
to allow running parallel tests. runTestSuite command will
come with a list of prepared sql tables
Modified:
erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in
Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py?rev=45591&r1=45590&r2=45591&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/__init__.py [utf8] Wed Apr 20 14:49:31 2011
@@ -76,6 +76,8 @@ class Recipe(BaseSlapRecipe):
conversion_server_conf, memcached_conf, kumo_conf, self.site_id)
self.installTestRunner(ca_conf, mysql_conf, conversion_server_conf,
memcached_conf, kumo_conf)
+ self.installTestSuiteRunner(ca_conf, mysql_conf, conversion_server_conf,
+ memcached_conf, kumo_conf)
self.linkBinary()
self.setConnectionDict(dict(
site_url=apache_conf['apache_login'],
@@ -162,11 +164,8 @@ class Recipe(BaseSlapRecipe):
def installTestRunner(self, ca_conf, mysql_conf, conversion_server_conf,
memcached_conf, kumo_conf):
- """Installs bin/runTestSuite executable to run all tests using
+ """Installs bin/runUnitTest executable to run all tests using
bin/runUnitTest"""
- # XXX: This method can be drastically simplified after #20110128-1ECA63
- # (ERP5 specific runUnitTest script shall be generated by erp5 eggg) will
- # be solved
testinstance = self.createDataDirectory('testinstance')
# workaround wrong assumptions of ERP5Type.tests.runUnitTest about
# directory existence
@@ -196,6 +195,43 @@ class Recipe(BaseSlapRecipe):
)])[0]
self.path_list.append(runUnitTest)
+ def installTestSuiteRunner(self, ca_conf, mysql_conf, conversion_server_conf,
+ memcached_conf, kumo_conf):
+ """Installs bin/runTestSuite executable to run all tests using
+ bin/runUnitTest"""
+ testinstance = self.createDataDirectory('test_suite_instance')
+ # workaround wrong assumptions of ERP5Type.tests.runUnitTest about
+ # directory existence
+ unit_test = os.path.join(testinstance, 'unit_test')
+ if not os.path.isdir(unit_test):
+ os.mkdir(unit_test)
+ connection_string_list = []
+ for test_database, test_user, test_password in \
+ mysql_conf['mysql_parallel_test_dict']:
+ connection_string_list.append(
+ '%s@%s:%s %s %s' % (test_database, mysql_conf['ip'],
+ mysql_conf['tcp_port'], test_user, test_password))
+ command = zc.buildout.easy_install.scripts([
+ ('runTestSuite', __name__ + '.test_suite_runner', 'runTestSuite')],
+ self.ws, sys.executable, self.bin_directory, arguments=[dict(
+ instance_home=testinstance,
+ prepend_path=self.bin_directory,
+ openssl_binary=self.options['openssl_binary'],
+ test_ca_path=ca_conf['certificate_authority_path'],
+ call_list=[self.options['runTestSuite_binary'],
+ '--db_list', ', '.join(connection_string_list),
+ '--conversion_server_hostname=%(conversion_server_ip)s' % \
+ conversion_server_conf,
+ '--conversion_server_port=%(conversion_server_port)s' % \
+ conversion_server_conf,
+ '--volatile_memcached_server_hostname=%(memcached_ip)s' % memcached_conf,
+ '--volatile_memcached_server_port=%(memcached_port)s' % memcached_conf,
+ '--persistent_memcached_server_hostname=%(kumo_gateway_ip)s' % kumo_conf,
+ '--persistent_memcached_server_port=%(kumo_gateway_port)s' % kumo_conf,
+ ]
+ )])[0]
+ self.path_list.append(command)
+
def installCrond(self):
timestamps = self.createDataDirectory('cronstamps')
cron_d = os.path.join(self.var_directory, 'cron.d')
@@ -555,6 +591,9 @@ SSLRandomSeed connect builtin
mysql_test_password=self.generatePassword(),
mysql_test_database=test_database,
mysql_test_user=test_user,
+ mysql_parallel_test_dict=[
+ ('test_%i' % x,)*2 + (self.generatePassword(),) \
+ for x in xrange(0,100)],
)
self._createDirectory(mysql_conf['data_directory'])
@@ -562,8 +601,22 @@ SSLRandomSeed connect builtin
self.substituteTemplate(self.getTemplateFilename('my.cnf.in'),
mysql_conf))
- mysql_script = pkg_resources.resource_string(__name__,
- 'template/initmysql.sql.in') % mysql_conf
+ mysql_script_list = []
+ for x_database, x_user, x_password in \
+ [(mysql_conf['mysql_database'],
+ mysql_conf['mysql_user'],
+ mysql_conf['mysql_password']),
+ (mysql_conf['mysql_test_database'],
+ mysql_conf['mysql_test_user'],
+ mysql_conf['mysql_test_password']),
+ ] + mysql_conf['mysql_parallel_test_dict']:
+ mysql_script_list.append(pkg_resources.resource_string(__name__,
+ 'template/initmysql.sql.in') % {
+ 'mysql_database': x_database,
+ 'mysql_user': x_user,
+ 'mysql_password': x_password})
+ mysql_script_list.append('EXIT')
+ mysql_script = '\n'.join(mysql_script_list)
self.path_list.extend(zc.buildout.easy_install.scripts([('mysql_update',
__name__ + '.mysql', 'updateMysql')], self.ws,
sys.executable, self.wrapper_directory, arguments=[dict(
Modified: erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in
URL: http://svn.erp5.org/erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in?rev=45591&r1=45590&r2=45591&view=diff
==============================================================================
--- erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in [utf8] (original)
+++ erp5/trunk/utils/slapos.recipe.erp5/src/slapos/recipe/erp5/template/initmysql.sql.in [utf8] Wed Apr 20 14:49:31 2011
@@ -1,5 +1,2 @@
CREATE DATABASE IF NOT EXISTS %(mysql_database)s;
GRANT ALL PRIVILEGES ON %(mysql_database)s.* TO %(mysql_user)s@'%%' IDENTIFIED BY '%(mysql_password)s';
-CREATE DATABASE IF NOT EXISTS %(mysql_test_database)s;
-GRANT ALL PRIVILEGES ON %(mysql_test_database)s.* TO %(mysql_test_user)s@'%%' IDENTIFIED BY '%(mysql_test_password)s';
-EXIT
More information about the Erp5-report
mailing list