Commit 63c34dd7 authored by Julien Muchembled's avatar Julien Muchembled

Fix TestERP5Administration.test_01_RunCheckStockTableAlarm

The test randomly failed since it was created because of low resolution of
creation_date column (in catalog table): Alarm.getLastActiveProcess failed
when the 2 last active processes were created in the same second.

This commit is a hack that relies on the fact that a new Active Process always
has an ID higher than previously created Active Processes.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28401 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c92f31e1
......@@ -508,7 +508,9 @@ Alarm Tool Node: %s
limit = self.isActive() and 2 or 1
active_process_list = self.getPortalObject().portal_catalog(
portal_type='Active Process', limit=limit,
sort_on=(('creation_date', 'DESC'), ),
sort_on=(('creation_date', 'DESC'),
# XXX Work around poor resolution of MySQL dates.
('CONVERT(`catalog`.`id`, UNSIGNED)', 'DESC')),
causality_uid=self.getUid())
if len(active_process_list) < limit:
process = None
......
......@@ -38,7 +38,7 @@ class TestERP5Administration(InventoryAPITestCase):
return "ERP5Administration"
def getBusinessTemplateList(self):
"""
"""
Same list as for Inventory API and add erp5_administration
"""
return InventoryAPITestCase.getBusinessTemplateList(self) + ('erp5_administration',)
......@@ -53,7 +53,7 @@ class TestERP5Administration(InventoryAPITestCase):
alarm = portal.portal_alarms.check_stock
def checkActiveProcess(failed):
transaction.get().commit()
transaction.commit()
self.tic()
self.assertEqual(alarm.getLastActiveProcess().ActiveProcess_sense(),
failed)
......@@ -68,7 +68,7 @@ class TestERP5Administration(InventoryAPITestCase):
alarm.setAlarmNotificationMode('never')
mvt = self._makeMovement(quantity=1.23)
transaction.get().commit()
transaction.commit()
self.tic()
alarm.activeSense()
checkActiveProcess(0)
......
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