Commit 97379162 authored by Jérome Perrin's avatar Jérome Perrin

software/erp5/test: expose _waitForActivities utility method

parent b2ef7dc7
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
import contextlib import contextlib
import datetime
import glob import glob
import http.client import http.client
import json import json
...@@ -450,10 +451,13 @@ class ZopeSkinsMixin: ...@@ -450,10 +451,13 @@ class ZopeSkinsMixin:
@classmethod @classmethod
def _setUpClass(cls): def _setUpClass(cls):
super()._setUpClass() super()._setUpClass()
param_dict = cls.getRootPartitionConnectionParameterDict() cls._waitForActivities()
# wait for ERP5 to be ready and have processed all activities
# from initial setup @classmethod
for _ in range(120): def _waitForActivities(cls, timeout=datetime.timedelta(minutes=10).total_seconds()):
"""Wait for ERP5 to be ready and have processed all activities.
"""
for _ in range(int(timeout / 5)):
with cls.getXMLRPCClient() as erp5_xmlrpc_client: with cls.getXMLRPCClient() as erp5_xmlrpc_client:
try: try:
if erp5_xmlrpc_client.portal_activities.countMessage() == 0: if erp5_xmlrpc_client.portal_activities.countMessage() == 0:
...@@ -464,7 +468,7 @@ class ZopeSkinsMixin: ...@@ -464,7 +468,7 @@ class ZopeSkinsMixin:
pass pass
time.sleep(5) time.sleep(5)
else: else:
raise AssertionError("ERP5 is not ready") raise AssertionError("Timeout waiting for activities")
@classmethod @classmethod
def _getAuthenticatedZopeUrl(cls, path, family_name='default'): def _getAuthenticatedZopeUrl(cls, path, family_name='default'):
......
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