Commit da44845a authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Lu Xu

erp5_test_result: rework slapos agent distributor

parent 27c22d64
......@@ -28,7 +28,7 @@ from Products.ERP5Type.XMLObject import XMLObject
from DateTime import DateTime
import json
import random
from zLOG import LOG,DEBUG,ERROR
from zLOG import LOG,DEBUG,ERROR,INFO
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
......@@ -271,7 +271,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
if test_node.getValidationState() != 'validated':
try:
test_node.validate()
except Exception as e:
except Exception, e:
LOG('Test Node Validate',ERROR,'%s' %e)
if test_node is None:
test_node = test_node_module.newContent(portal_type="Test Node", title=title, computer_guid=computer_guid,
......@@ -384,7 +384,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
for x in to_delete_key_list:
config.pop(x)
config_list.append(config)
LOG('ERP5ProjectUnitTestDistributor.startTestSuite, config_list',DEBUG,config_list)
LOG('ERP5ProjectUnitTestDistributor.startTestSuite, config_list',INFO,config_list)
if batch_mode:
return config_list
return json.dumps(config_list)
......@@ -395,12 +395,13 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
"""
Here this is only a proxy to the task distribution tool
"""
LOG('ERP5ProjectUnitTestDistributor.createTestResult', DEBUG, (node_title, test_title))
LOG('ERP5ProjectUnitTestDistributor.createTestResult', INFO, (node_title, test_title))
portal = self.getPortalObject()
if node_title:
test_node = self._getTestNodeFromTitle(node_title)
test_node.setPingDate()
test_suite = self._getTestSuiteFromTitle(test_title)
LOG('ERP5ProjectUnitTestDistributor.createTestResult 2', INFO, (test_suite))
if test_suite is not None:
if not allow_restart and test_suite.isEnabled():
# in case if allow_restart is not enforced by client and test_node
......@@ -430,6 +431,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
return test_node
def _getTestSuiteFromTitle(self, suite_title):
LOG('ERP5ProjectUnitTestDistributor._getTestSuiteFromTitle', INFO, (suite_title, self._getTestSuiteModule()))
test_suite_list = self._getTestSuiteModule().searchFolder(
portal_type='Test Suite',
title=SimpleQuery(comparison_operator='=', title=suite_title),
......
......@@ -128,7 +128,7 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
if test_node.getValidationState() != 'validated':
try:
test_node.validate()
except Exception as e:
except Exception, e:
LOG('Test Node Validate',ERROR,'%s' %e)
return test_node
return None
......
......@@ -26,7 +26,9 @@
##############################################################################
from erp5.component.document.ERP5ProjectUnitTestDistributor import ERP5ProjectUnitTestDistributor
from DateTime import DateTime
from zLOG import LOG,DEBUG,ERROR,INFO
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
import json
......@@ -65,41 +67,115 @@ class SlapOSAgentDistributor(ERP5ProjectUnitTestDistributor):
"""
return 'SlapOSAgentTest'
security.declarePublic("createTestResult")
def createTestResult(self, name, revision, test_name_list, allow_restart,
test_title=None, node_title=None, project_title=None):
"""
Here this is only a proxy to the task distribution tool
"""
LOG('SlapOSAgentDistributor.createTestResult', INFO, (node_title, test_title, revision))
portal = self.getPortalObject()
if node_title:
test_node = self._getTestNodeFromTitle(node_title)
test_node.setPingDate()
test_suite = self._getTestSuiteFromTitle(test_title)
LOG('SlapOSAgentDistributor.createTestResult 2', INFO, (test_suite))
if test_suite is not None:
if not allow_restart and test_suite.isEnabled():
# in case if allow_restart is not enforced by client and test_node
# periodicity is enabled control the restartability based on test_suite
# periodicity
current_date = DateTime()
alarm_date = test_suite.getAlarmDate()
if alarm_date is None or alarm_date <= current_date:
allow_restart = True
test_suite.setAlarmDate(
test_suite.getNextPeriodicalDate(current_date, alarm_date))
#test_suite.setPingDate()
return portal.portal_task_distribution.createTestResult(name,
revision, test_name_list, allow_restart,
test_title=test_title, node_title=node_title,
project_title=project_title)
def _getTestNodeFromTitle(self, node_title):
test_node_list = self._getTestNodeModule().searchFolder(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=node_title),
limit=2
)
assert len(test_node_list) == 1, "We found %i test nodes for %s" % (
len(test_node_list), node_title)
test_node = test_node_list[0].getObject()
return test_node
def _getTestSuiteFromTitle(self, suite_title):
LOG('SlapOSAgentDistributor._getTestSuiteFromTitle', INFO, (suite_title, self._getTestSuiteModule()))
test_suite_list = self._getTestSuiteModule().searchFolder(
portal_type='SlapOS Agent Test Suite',
title=SimpleQuery(comparison_operator='=', title=suite_title),
validation_state='validated',
limit=2)
assert len(test_suite_list) <= 1, "We found %i test suite for %s" % (
len(test_suite_list), suite_title)
test_suite = None
if len(test_suite_list):
test_suite = test_suite_list[0].getObject()
return test_suite
security.declarePublic("generateConfiguration")
def generateConfiguration(self, test_suite_title, batch_mode=0):
"""
generateConfiguration : this is just a proxy to an external method
generateConfiguration : not used for slapos agent
"""
test_suite_module = self._getTestSuiteModule()
return json.dumps({"configuration_list": [{}]})
security.declarePublic("getServiceList")
def getServiceList(self, test_suite_title):
"""
getServiceList : return a dict containing the list of services to request to slapos master before running the test
"""
LOG('[SlapOSAgentDistributor] getServiceList', INFO, test_suite_title)
test_suite_module = self._getTestSuiteModule()
test_suite_list = test_suite_module.searchFolder(
title=test_suite_title,
validation_state="validated",
specialise_uid=self.getUid())
service_list = {}
if len(test_suite_list) == 0:
return json.dumps({})
error_message = 'Error getting test suite information. Bad test suite title? '
LOG('[SlapOSAgentDistributor] getServiceList', ERROR, error_message)
return json.dumps({'error_message': error_message})
generated_configuration = {}
for unit_test in test_suite_list[0].searchFolder(
portal_type="SlapOS Software Release Unit Test"):
generated_configuration[unit_test.getTitle()] = {
LOG('[SlapOSAgentDistributor] getServiceList, unit_test: ', INFO, unit_test.getTitle())
service_list[unit_test.getTitle()] = {
"title": unit_test.getTitle(),
"url": unit_test.getUrlString(),
"group": unit_test.getGroupReference("default")}
if unit_test.getTextContent() is not None:
generated_configuration[unit_test.getTitle()]['request_kw'] = unit_test.getTextContent()
"group": unit_test.getGroupReference("default"),
"shared" : unit_test.getShared(),
"software_type" : unit_test.getSoftwareType(),
"partition_parameter_kw" : unit_test.getTextContent(),
"filter_kw" : unit_test.getFilterKw()
}
if unit_test.getSupplyComputer() is not None:
generated_configuration[unit_test.getTitle()]['supply_computer'] = unit_test.getSupplyComputer()
return json.dumps(generated_configuration)
service_list[unit_test.getTitle()]['supply_computer'] = unit_test.getSupplyComputer()
LOG('[SlapOSAgentDistributor] getServiceList, final service_list: ', INFO, service_list)
return json.dumps(service_list)
def _getSortedNodeTestSuiteToRun(self, test_node):
"""
Returned ordered list of test suites of a test node.
For now do nothing
"""
test_suite_list = test_node.getAggregateValueList()
return test_suite_list
......
......@@ -39,7 +39,9 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W: 30, 0: Unused DEBUG imported from zLOG (unused-import)</string>
</tuple>
</value>
</item>
<item>
......
......@@ -110,7 +110,7 @@ def generateConfigurationList(self, test_suite_title):
remaining_nodes = list(available_nodes)
launcher_nodes = []
launcher_nodes.append( remaining_nodes.pop() )
# Make list with only the computer_guid property of each node (to be used directly by template)
remaining_nodes_computer_guid = [unvalid_node] + [ node.getReference() for node in remaining_nodes ] + [unvalid_node]
launcher_nodes_computer_guid = [ node.getReference() for node in launcher_nodes ]
......@@ -149,6 +149,6 @@ def generateConfigurationList(self, test_suite_title):
computer_guid = node.getReference()
if _isInMyDictOrListRec(return_dict, computer_guid):
involved_nodes_computer_guid.append(computer_guid)
return_dict['involved_nodes_computer_guid'] = involved_nodes_computer_guid
return return_dict
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/text</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>filter_kw_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/boolean</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Is it shared instance</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>shared_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/text</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>software_type used for the service</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>software_type_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -104,6 +104,9 @@
<string>my_url_string</string>
<string>my_supply_computer</string>
<string>my_group_reference</string>
<string>my_software_type</string>
<string>my_shared</string>
<string>my_filter_kw</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_shared</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>This field is mandatory.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Shared</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_duration</string> </value>
<value> <string>my_software_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -77,10 +77,6 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
......@@ -122,9 +118,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -158,10 +152,6 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
......@@ -251,7 +241,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Duration</string> </value>
<value> <string>Software Type</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
......@@ -271,17 +261,4 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: modules[\'datetime\'].timedelta(seconds=cell.getProperty(\'duration\'))</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Request KW (json format)</string> </value>
<value> <string>partition_parameter_kw (json format)</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
......
from DateTime import DateTime
now = DateTime()
#Clean-up invalidated Test Nodes and
# invalidate inactive ones
# invalidate inactive ones
list_node = context.portal_catalog(
portal_type="Test Node",
)
......@@ -30,7 +30,7 @@ for test_node in list_node:
portal = context.getPortalObject()
distributor_list = portal.portal_task_distribution.objectValues()
for distributor in distributor_list:
for distributor in distributor_list:
distributor.activate(tag=tag).optimizeConfiguration()
context.activate(after_tag=tag).getId()
......
......@@ -23,7 +23,7 @@ expected_title = context.getTitle()
for tr in context.portal_catalog(**query_params):
line_found = False
tr = tr.getObject()
# Optimisation: the test result line probably have the same id in the previous
# test result.
line = getattr(tr, expected_id, None)
......@@ -45,5 +45,5 @@ for tr in context.portal_catalog(**query_params):
# return as many test result line as the count method returns.
if not line_found:
result_list.append(tr.asContext(string_index='NOT_EXECUTED'))
return result_list
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/>
<global name="FloatField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
......@@ -19,12 +19,12 @@
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
<key> <string>not_float</string> </key>
<value> <string>You did not enter a floating point number.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
</dictionary>
</value>
......@@ -78,11 +78,11 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
......@@ -93,14 +93,6 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
......@@ -122,9 +114,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -159,11 +149,11 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<key> <string>input_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<key> <string>precision</string> </key>
<value> <string></string> </value>
</item>
<item>
......@@ -174,14 +164,6 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
......@@ -238,12 +220,12 @@
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string>text</string> </value>
<key> <string>input_style</string> </key>
<value> <string>-1 234.5</string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
<key> <string>precision</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>required</string> </key>
......@@ -253,14 +235,6 @@
<key> <string>title</string> </key>
<value> <string>Duration</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
......@@ -271,17 +245,4 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: modules[\'datetime\'].timedelta(seconds=context.getProperty(\'duration\'))</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -43,7 +43,7 @@ for test_id, test_result in all_test_results.items():
cmdline=log_files.get('cmdline'),
stdout=log_files.get('stdout'),
stderr=log_files.get('stderr'),)
test_report.edit(string_index=form.get('result'),
all_tests=all_tests,
......
import json
# Get result lines
test_result_lines = context.objectValues(portal_type="Test Result Line",
test_result_lines = context.objectValues(portal_type="Test Result Line",
sort_on="int_index")
# Create a dict containing stats for each test
......@@ -24,7 +24,7 @@ for tl in test_result_lines:
# initial init
if test_name not in results.keys():
results[test_name] = []
results[test_name].append({'created_docs': test_documents_created,
results[test_name].append({'created_docs': test_documents_created,
'duration':3600})
test_suite = context.getPortalObject().test_suite_module.searchFolder(title=context.getTitle())[0]
......@@ -35,5 +35,5 @@ xs = map(int, test_suite.getGraphCoordinate())
# viewer shows only one graph thus return only one test
tests = results[test_suite_name]
return json.dumps({"test": tests,
return json.dumps({"test": tests,
"xs": xs})
......@@ -10,7 +10,7 @@ def makeVCSLink(repository_url, revision):
if 'lab.nexedi' in repository_url and repository_url.endswith('.git'):
repository_url = repository_url[:-len('.git')]
if '@' in repository_url: # remove credentials
scheme = repository_url.split(':')[0]
scheme = repository_url.split(':')[0]
url = '%s://%s/commit/%s' % (scheme, repository_url.split('@')[1], revision )
else:
url = '%s/commit/%s' % (repository_url, revision )
......@@ -21,14 +21,14 @@ def makeVCSLink(repository_url, revision):
def getListItemUrl(*args, **kw):
return url
return Object(
uid='new_',
getUid=lambda: 'new_',
getListItemUrl=getListItemUrl,
repository=repository_url,
revision=revision)
for repository in test_suite_data['repository_dict'].values():
result_list.append(
makeVCSLink(
......
......@@ -3,21 +3,21 @@ test_result = context
result = []
p = result.append
if len([x for x in test_result.contentValues(portal_type='Test Result Node')
if x.getSimulationState() == 'failed']):
if len([x for x in test_result.contentValues(portal_type='Test Result Node')
if x.getSimulationState() == 'failed']):
p('Result: %s (Building Failed)' % test_result.getStringIndex() )
else:
p('Result: %s' % test_result.getStringIndex())
#p('Test Suite: %s' % test_result.getTitle())
p('Revision: %s' % test_result.getReference() or test_result.getIntIndex())
#p('Test Suite: %s' % test_result.getTitle())
p('Revision: %s' % test_result.getReference() or test_result.getIntIndex())
p('Launch Date: %s' % test_result.getStartDate())
comment = test_result.getProperty('comment')
if comment:
comment = test_result.getProperty('comment')
if comment:
p(comment)
p('')
p('')
p('All tests: %s, Failures: %s, Errors: %s, Skips: %s' % \
(test_result.getProperty('all_tests'),
(test_result.getProperty('all_tests'),
test_result.getProperty('failures'),
test_result.getProperty('errors'),
test_result.getProperty('skips')))
......
......@@ -3,7 +3,7 @@
"""
test_suite_list = []
test_result_line_list = context.objectValues(
portal_type = 'Test Result Line',
portal_type = 'Test Result Line',
sort_on="int_index")
if len(test_result_line_list) > 0:
......
test_result = context
return "%s (T:%s/F:%s/E:%s/S:%s)" % (context.getTitle(),
test_result.getProperty('all_tests'),
test_result.getProperty('all_tests'),
test_result.getProperty('failures'),
test_result.getProperty('errors'),
test_result.getProperty('skips'))
import datetime
from Products.PythonScripts.standard import Object
return [Object(duration=datetime.timedelta(seconds=context.getProperty('duration', 0)),
return [Object(duration=int(context.getProperty('duration', 0)),
all_tests=context.getProperty('all_tests'),
errors=context.getProperty('errors'),
failures=context.getProperty('failures'),
......
......@@ -87,7 +87,6 @@
<list>
<string>listbox_string_index</string>
<string>listbox_start_date</string>
<string>listbox_duration</string>
</list>
</value>
</item>
......@@ -100,7 +99,6 @@
<string>my_id</string>
<string>my_start_date</string>
<string>my_stop_date</string>
<string>your_real_duration</string>
</list>
</value>
</item>
......
......@@ -12,7 +12,7 @@ test_suite = context.newContent(
test_suite = config['test_suite'],
int_index = config['int_index'],
vcs_repository = test_suite_repository
)
)
if batch_mode:
return test_suite
......@@ -31,7 +31,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, NegatedQuery
from zLOG import LOG, DEBUG
from zLOG import LOG, DEBUG, INFO
from xmlrpclib import Binary
class TaskDistributionTool(BaseTool):
......@@ -89,7 +89,7 @@ class TaskDistributionTool(BaseTool):
-> (test_result_path, revision) or None if already completed
"""
LOG('createTestResult', DEBUG, (name, revision, test_title, project_title))
LOG('tool.erp5.TaskDistributionTool.createTestResult', INFO, (name, revision, test_title, project_title))
portal = self.getPortalObject()
if test_title is None:
test_title = name
......@@ -215,6 +215,7 @@ class TaskDistributionTool(BaseTool):
# following 2 functions only call 'newContent' on test_result
createTestResultLineList(test_result, test_name_list)
createNode(test_result, node_title)
LOG('createTestResult RESULT', INFO, (test_result.getRelativeUrl(), revision))
return test_result.getRelativeUrl(), revision
security.declarePublic('startUnitTest')
......
......@@ -15,4 +15,4 @@ if test_result.getPortalType() == 'Test Result Node':
edit_kw[key] = key_value
test_result.edit(**edit_kw)
else:
container.script_TestResult_complete(sci)
context.TestResult_complete(sci)
......@@ -18,7 +18,7 @@ if test_suite.getReference() is None:
test_suite.setReference(int2letter(new_id))
def generateRandomString(size):
tab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
tab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
my_string = ''
for _ in range(size):
my_string = my_string + choice(tab)
......
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