Commit e368cf4f authored by Ivan Tyagov's avatar Ivan Tyagov

Set int_index at Test Result creation time as it is really needed for showing...

Set int_index at Test Result creation time as it is really needed for showing graph, test order execution in case of Scalability Tests and use int_index in scripts.
parent 54398666
...@@ -35,7 +35,7 @@ import json ...@@ -35,7 +35,7 @@ import json
import jinja2 import jinja2
from Products.ERP5.Tool.TaskDistributionTool import TaskDistributionTool from Products.ERP5.Tool.TaskDistributionTool import TaskDistributionTool
class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor, object):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
...@@ -166,10 +166,17 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor): ...@@ -166,10 +166,17 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
""" """
LOG('[ERP5ScalabilityDistributor] createTestResult', 0, (node_title, test_title)) LOG('[ERP5ScalabilityDistributor] createTestResult', 0, (node_title, test_title))
portal = self.getPortalObject() portal = self.getPortalObject()
return portal.portal_task_distribution.createTestResult(name, created_test_result_tuple = portal.portal_task_distribution.createTestResult(name,
revision, test_name_list, allow_restart, revision, test_name_list, allow_restart,
test_title=test_title, node_title=node_title, test_title=test_title, node_title=node_title,
project_title=project_title) project_title=project_title)
# set int_index which is used for sorting to the title of the test case
# in created_test_result_tuple we have test result relative url and revision
test_result = portal.restrictedTraverse(created_test_result_tuple[0])
for test_result_line in test_result.objectValues(portal_type = "Test Result Line"):
test_result_line.setIntIndex(int(test_result_line.getTitle()))
return created_test_result_tuple
security.declarePublic("startTestSuite") security.declarePublic("startTestSuite")
def startTestSuite(self,title, computer_guid='unknown', batch_mode=0): def startTestSuite(self,title, computer_guid='unknown', batch_mode=0):
......
...@@ -2,11 +2,8 @@ from Products.PythonScripts.standard import Object ...@@ -2,11 +2,8 @@ from Products.PythonScripts.standard import Object
import json import json
# Get result lines # 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")
# XXX: Test Result Line misses int_index and test title is used for this.
# we need to fix this but for backwards compatability use it now.
test_result_lines = sorted(test_result_lines, key=lambda x: int(x.getTitle()))
# Create a dict containing stats for each test # Create a dict containing stats for each test
tests = [] tests = []
...@@ -39,4 +36,5 @@ xs = map(int, test_suite.getGraphCoordinate()) ...@@ -39,4 +36,5 @@ xs = map(int, test_suite.getGraphCoordinate())
# viewer shows only one graph thus return only one test # viewer shows only one graph thus return only one test
tests = results[test_suite_name] tests = results[test_suite_name]
return json.dumps({"test": tests, "xs": xs}) return json.dumps({"test": tests,
"xs": xs})
...@@ -343,6 +343,10 @@ ...@@ -343,6 +343,10 @@
<string>title</string> <string>title</string>
<string>Test Case</string> <string>Test Case</string>
</tuple> </tuple>
<tuple>
<string>int_index</string>
<string>Int Index</string>
</tuple>
<tuple> <tuple>
<string>start_date</string> <string>start_date</string>
<string>Start Date</string> <string>Start Date</string>
......
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