Commit d86e6370 authored by Pere Cortes's avatar Pere Cortes Committed by Sebastien Robin

erp5testnode getting test suites from master

- test node support much less parameters, it will get them from
  the master
- testnode get list of test suite to install
- the instance folder structure has changed to support multiple
  test suites
- test node will delete useless test suites data if needed
- the master url should be a sub object (distributor) inside
  the task distibution tool
- the long run method has been splitted in many smaller methods
  (it is still possible to go futher
parent 65681d8a
......@@ -173,7 +173,7 @@ class TestResultLineProxy(RPCRetry):
if kw:
self._logger.info('Extra parameters provided: %r', kw)
status_dict.update(kw)
self._retryRPC('stopUnitTest', (self._test_result_line_path,
self._retryRPC('stopUnitTest', (self._test_result_line_path,self.node_title,
status_dict))
class TestResultProxy(RPCRetry):
......@@ -204,7 +204,6 @@ class TestResultProxy(RPCRetry):
self._watcher_period = 60
self._watcher_dict = {}
self._watcher_condition = threading.Condition()
def __repr__(self):
return '<%s(%r, %r, %r) at %x>' % (self.__class__.__name__,
self._test_result_path, self._node_title, self._revision, id(self))
......@@ -220,7 +219,7 @@ class TestResultProxy(RPCRetry):
Return an TestResultLineProxy instance, or None if there is nothing to
do.
"""
result = self._retryRPC('startUnitTest', (self._test_result_path,
result = self._retryRPC('startUnitTest', (self._test_result_path,self.node_title,
exclude_list))
if result:
line_url, test_name = result
......@@ -414,6 +413,33 @@ class TaskDistributionTool(RPCRetry):
self._logger, test_result_path, node_title, revision)
return result
class TaskDistributor(RPCRetry):
def __init__(self,portal_url,retry_time=64,logger=None):
if logger is None:
logger = null_logger
if portal_url is None:
proxy = DummyTaskDistributionTool()
else:
proxy = xmlrpclib.ServerProxy(
portal_url,
allow_none=True,
)
super(TaskDistributor, self).__init__(proxy, retry_time,logger)
protocol_revision = self._retryRPC('getProtocolRevision')
if protocol_revision != 1:
raise ValueError('Unsupported protocol revision: %r',
protocol_revision)
def startTestSuite(self,node_title):
"""
Returns None if no test suite is needed.
therwise, returns a JSON with all the test suite parameters.
"""
result = self._retryRPC('startTestSuite',(node_title,))
return result
class DummyTaskDistributionTool(object):
"""
Fake remote server.
......
......@@ -70,48 +70,23 @@ def main(*args):
# do not change case of option keys
config.optionxform = str
config.readfp(parsed_argument.configuration_file[0])
for key in ('slapos_directory', 'working_directory', 'test_suite_directory',
'log_directory', 'run_directory', 'proxy_host', 'proxy_port',
'git_binary', 'zip_binary', 'test_suite_title', 'test_node_title',
'test_suite', 'project_title', 'node_quantity', 'ipv4_address',
'ipv6_address', 'test_suite_master_url', 'slapgrid_partition_binary',
'slapgrid_software_binary', 'slapproxy_binary'):
CONFIG[key] = config.get('testnode', key)
for key in ('slapos_directory','working_directory','test_suite_directory',
'log_directory','run_directory','proxy_host','proxy_port',
'git_binary','zip_binary','node_quantity','test_node_title',
'ipv4_address','ipv6_address','test_suite_master_url',
'slapgrid_partition_binary','slapgrid_software_binary',
'slapproxy_binary'):
CONFIG[key] = config.get('testnode',key)
for key in ('slapos_directory', 'working_directory', 'test_suite_directory',
'log_directory', 'run_directory'):
d = CONFIG[key]
if not os.path.isdir(d):
raise ValueError('Directory %r does not exists.' % d)
slapos_directory = CONFIG['slapos_directory']
CONFIG['software_root'] = software_root = os.path.join(slapos_directory,
'software')
CONFIG['instance_root'] = instance_root = os.path.join(slapos_directory,
'instance')
CONFIG['proxy_database'] = os.path.join(slapos_directory, 'proxy.db')
CONFIG['slapos_config'] = slapos_config = os.path.join(slapos_directory,
'slapos.cfg')
if not os.path.lexists(software_root):
os.mkdir(software_root)
CONFIG['master_url'] = 'http://%s:%s' % (CONFIG['proxy_host'],
CONFIG['proxy_port'])
open(slapos_config, 'w').write(pkg_resources.resource_string(
'erp5.util.testnode', 'template/slapos.cfg.in') % CONFIG)
CONFIG['runTestSuite'] = os.path.join(instance_root,
CONFIG['partition_reference'], 'bin', 'runTestSuite')
# generate vcs_repository_list
vcs_repository_list = []
for section in config.sections():
if section.startswith('vcs_repository'):
vcs_repository_list.append(dict(config.items(section)))
CONFIG['bt5_path'] = None
if 'bt5_path' in config.options("testnode"):
bt5_path = config.get("testnode", 'bt5_path')
if bt5_path.lower() != "none":
CONFIG['bt5_path'] = bt5_path
CONFIG['vcs_repository_list'] = vcs_repository_list
if 'bot_environment' in config.sections():
bot_environment = dict(config.items('bot_environment'))
else:
......
This diff is collapsed.
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