Commit 8cc256c8 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use '=' comparison operator explicitly in title search.

otherwise full text index is used where keywords that appear in more than 50% of rows are ignored.
parent 55985c7d
......@@ -26,6 +26,7 @@
##############################################################################
from Products.ERP5.Document.ERP5ProjectUnitTestDistributor import ERP5ProjectUnitTestDistributor
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from zLOG import LOG,ERROR
from AccessControl import ClassSecurityInfo
......@@ -110,7 +111,10 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
tag = "%s_%s" % (self.getRelativeUrl(), title)
if portal.portal_activities.countMessageWithTag(tag) == 0:
test_node_list = test_node_module.searchFolder(portal_type="Test Node",title=title)
test_node_list = test_node_module.searchFolder(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=title),
)
assert len(test_node_list) in (0, 1), "Unable to find testnode : %s" % title
test_node = None
if len(test_node_list) == 1:
......@@ -129,7 +133,8 @@ class ERP5ScalabilityDistributor(ERP5ProjectUnitTestDistributor):
isMasterTestnode : return True if the node given in parameter exists and is a validated master
"""
test_node_module = self._getTestNodeModule()
test_node_master = [ node for node in test_node_module.searchFolder(portal_type="Test Node", title=title,
test_node_master = [ node for node in test_node_module.searchFolder(portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=title),
specialise_uid=self.getUid(),
validation_state="validated") if node.getMaster() == 1 ]
if len(test_node_master) == 1:
......
......@@ -37,7 +37,7 @@ import string
from zLOG import LOG,INFO,ERROR
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
TEST_SUITE_MAX = 4
# Depending on the test suite priority, we will affect
# more or less cores
......@@ -210,7 +210,10 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
tag = "%s_%s" % (self.getRelativeUrl(), title)
if portal.portal_activities.countMessageWithTag(tag) == 0:
test_node_list = test_node_module.searchFolder(portal_type="Test Node",title=title)
test_node_list = test_node_module.searchFolder(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=title),
)
assert len(test_node_list) in (0, 1), "Unable to find testnode : %s" % title
test_node = None
if len(test_node_list) == 1:
......@@ -244,9 +247,11 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
from_date = now - 30
def getTestSuiteSortKey(test_suite):
test_result = portal.portal_catalog(portal_type="Test Result",
title='="%s"' % test_suite.getTitle(),
modification_date=Query(**{"creation_date": from_date,
"range": "min"}),
title=SimpleQuery(title=test_suite.getTitle()),
creation_date=SimpleQuery(
creation_date=from_date,
comparison_operator='>=',
),
sort_on=[("modification_date", "descending")],
limit=1)
if len(test_result):
......@@ -268,7 +273,10 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
config_list = []
tag = "%s_%s" % (self.getRelativeUrl(), title)
if portal.portal_activities.countMessageWithTag(tag) == 0:
test_node_list = test_node_module.searchFolder(portal_type="Test Node",title=title)
test_node_list = test_node_module.searchFolder(
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=title),
)
assert len(test_node_list) in (0, 1), "Unable to find testnode : %s" % title
test_node = None
if len(test_node_list) == 1:
......@@ -329,7 +337,9 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
def _getTestNodeFromTitle(self, node_title):
test_node_list = self._getTestNodeModule().searchFolder(
portal_type='Test Node', title="='%s'" % node_title)
portal_type="Test Node",
title=SimpleQuery(comparison_operator='=', title=node_title),
)
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()
......@@ -337,7 +347,9 @@ class ERP5ProjectUnitTestDistributor(XMLObject):
def _getTestSuiteFromTitle(self, suite_title):
test_suite_list = self._getTestSuiteModule().searchFolder(
portal_type='Test Suite', title="='%s'" % suit_tile, validation_state="validated")
portal_type='Test Suite',
title=SimpleQuery(comparison_operator='=', title=suite_title),
validation_state='validated')
assert len(test_suite_list) == 1, "We found %i test suite for %s" % (
len(test_suite_list), name)
test_suite = test_suite_list[0].getObject()
......
......@@ -30,6 +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 zLOG import LOG
from xmlrpclib import Binary
......@@ -91,7 +92,7 @@ class TaskDistributionTool(BaseTool):
def createTestResultLineList(test_result, test_name_list):
duration_list = []
previous_test_result_list = portal.test_result_module.searchFolder(
title='="%s"' % test_result.getTitle(),
title=SimpleQuery(comparison_operator='=', title=test_result.getTitle()),
sort_on=[('creation_date','descending')],
simulation_state=('stopped', 'public_stopped'),
limit=1)
......@@ -126,7 +127,7 @@ class TaskDistributionTool(BaseTool):
int_index, reference = revision
result_list = portal.test_result_module.searchFolder(
portal_type="Test Result",
title='="%s"' % test_title,
title=SimpleQuery(comparison_operator='=', title=test_title),
sort_on=(("creation_date","descending"),),
limit=1)
if result_list:
......@@ -162,7 +163,7 @@ class TaskDistributionTool(BaseTool):
test_result._setIntIndex(int_index)
if project_title is not None:
project_list = portal.portal_catalog(portal_type='Project',
title='="%s"' % project_title)
title=SimpleQuery(comparison_operator='=', title=project_title))
if len(project_list) != 1:
raise ValueError('found this list of project : %r for title %r' % \
([x.path for x in project_list], project_title))
......
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