Commit 58173b90 authored by Romain Courteaud's avatar Romain Courteaud

[ERP5] Task Distribution: no need to fetch full catalog result when looking for 2 results

parent 9d356026
......@@ -429,6 +429,7 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
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)
......@@ -439,7 +440,8 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
test_suite_list = self._getTestSuiteModule().searchFolder(
portal_type='Test Suite',
title=SimpleQuery(comparison_operator='=', title=suite_title),
validation_state='validated')
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
......
......@@ -59,6 +59,7 @@ class TaskDistributionTool(BaseTool):
test_node_list = portal.portal_catalog(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=node_title),
limit=2
)
if len(test_node_list) == 1:
return test_node_list[0].getRelativeUrl()
......
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