Commit 2063027f authored by Sebastien Robin's avatar Sebastien Robin

test_result: fixed random unit test failure

Since we have precision to second in the catalog, we sometimes had the
cancelled test result from the previous test disurbing the test_07. By the way,
directly filter out cancelled test result with TaskDistributionTool.createTestResult
since they should be ignored.
parent 8f58ae08
......@@ -328,8 +328,9 @@ class TestTaskDistribution(ERP5TypeTestCase):
def test_07_reportTaskFailure(self):
test_result_path, revision = self._createTestResult(node_title="Node0")
test_result_path, revision = self._createTestResult(node_title="Node1")
test_result = self.getPortalObject().unrestrictedTraverse(test_result_path)
next_test_result_path, revision = self._createTestResult(node_title="Node1")
self.assertEqual(test_result_path, next_test_result_path)
test_result = self.getPortalObject().unrestrictedTraverse(test_result_path)
self.assertEqual("started", test_result.getSimulationState())
node_list = test_result.objectValues(portal_type="Test Result Node",
sort_on=[("title", "ascending")])
......@@ -803,3 +804,4 @@ class TestTaskDistribution(ERP5TypeTestCase):
def test_19_testMultiDistributor(self):
pass
......@@ -30,7 +30,7 @@ import random
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, NegatedQuery
from zLOG import LOG
from xmlrpclib import Binary
......@@ -129,6 +129,7 @@ class TaskDistributionTool(BaseTool):
portal_type="Test Result",
title=SimpleQuery(comparison_operator='=', title=test_title),
sort_on=(("creation_date","descending"),),
query=NegatedQuery(SimpleQuery(simulation_state="cancelled")),
limit=1)
if result_list:
test_result = result_list[0].getObject()
......
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