Commit 3453958d authored by Jérome Perrin's avatar Jérome Perrin

testnode: propagate test_node_title to runTestSuite

runTestSuite accept a --test_node_title argument, which is used in
createTestResult API call, so that task distributor can keep track of which
node executed which task, but since it was not passed, we did not know which
test node executed which test result line.

See merge request nexedi/erp5!1205
parents 5b569c13 77d0a094
......@@ -91,6 +91,7 @@
<string>my_title</string>
<string>my_duration</string>
<string>my_parent_int_index</string>
<string>my_source_title</string>
<string>your_hide_expected_failure</string>
</list>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>editable</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_source_title</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>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</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>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Test Node</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -534,7 +534,7 @@ class TestTaskDistribution(TaskDistributionTestCase):
"""
We will check the method createTestResult of distributor
"""
self._createTestNode()
test_node, = self._createTestNode()
self.tic()
test_result_path, revision = self._createTestResult()
self.assertEqual("r0=a,r1=a", revision)
......@@ -558,7 +558,11 @@ class TestTaskDistribution(TaskDistributionTestCase):
self.assertEqual(2, len(line_list))
self.assertEqual(set(['testFoo', 'testBar']), set([x.getTitle() for x
in line_list]))
line_url, _ = self.tool.startUnitTest(test_result_path)
line_url, _ = self.tool.startUnitTest(test_result_path, node_title=test_node.getTitle())
# when node_title is passed to startUnitTest, we have a relation from test result line
# to test node
test_result_line = self.portal.restrictedTraverse(line_url)
self.assertEqual(test_result_line.getSourceValue(), test_node)
result = self._createTestResult(test_list=['testFoo', 'testBar'])
self.assertEqual((test_result_path, revision), result)
self.tool.startUnitTest(test_result_path)
......
......@@ -650,7 +650,7 @@ shared = true
# but the runTestSuite program is called with the actual distributor URL
self.assertEqual(
'runTestSuite called with: --master_url https://user:secret@example.com/portal_distributions'
' --revision dummy=0- --test_suite Foo --test_suite_title Foo-Test',
' --revision dummy=0- --test_node_title Foo-Test-Node --test_suite Foo --test_suite_title Foo-Test',
temp_file.read().strip())
# The root logger (which logs only in var/log/erp5testnode.log) contain the non obfuscated
......@@ -690,6 +690,7 @@ shared = true
expected_parameter_list = [path,
'--master_url', 'http://foo.bar',
'--revision', 'dummy=0-',
'--test_node_title', 'Foo-Test-Node',
'--test_suite', 'Foo',
'--test_suite_title', 'Foo-Test',
]
......
......@@ -143,6 +143,7 @@ class UnitTestRunner(object):
invocation_list += (run_test_suite_path,
'--master_url', portal_url,
'--revision', node_test_suite.revision,
'--test_node_title', config['test_node_title'],
'--test_suite', node_test_suite.test_suite,
'--test_suite_title', node_test_suite.test_suite_title)
soft = config['slapos_directory'] + '/soft/'
......
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