Commit 18475cc8 authored by Jérome Perrin's avatar Jérome Perrin

software/erp5/test: fix flaky test_activity_processing

wait a first time that ERP5 have finished processing activities for
initial site creation and tolerate that during this time zopes might
reply with error code
parent f4734133
Pipeline #19331 failed with stage
in 0 seconds
...@@ -802,6 +802,30 @@ class ZopeTestMixin(CrontabMixin): ...@@ -802,6 +802,30 @@ class ZopeTestMixin(CrontabMixin):
self.assertIn('Thread ', dump_response.text) self.assertIn('Thread ', dump_response.text)
def test_activity_processing(self): def test_activity_processing(self):
def wait_for_activities(max_retries):
for retry in range(max_retries):
time.sleep(10)
resp = requests.get(
self.zope_verify_activity_processing_url,
params={
'mode': 'count',
'retry': retry,
},
verify=False,
)
if not resp.ok:
# XXX we start by flushing existing activities from site creation
# and inital upgrader run. During this time it may happen that
# ERP5 replies with site errors, we tolerate these errors and only
# check the final state.
continue
count = resp.json()['count']
if not count:
break
else:
self.assertEqual(count, 0)
wait_for_activities(60)
requests.get( requests.get(
self.zope_verify_activity_processing_url, self.zope_verify_activity_processing_url,
params={ params={
...@@ -809,21 +833,7 @@ class ZopeTestMixin(CrontabMixin): ...@@ -809,21 +833,7 @@ class ZopeTestMixin(CrontabMixin):
}, },
verify=False, verify=False,
).raise_for_status() ).raise_for_status()
wait_for_activities(10)
for retry in range(60):
time.sleep(10)
count = requests.get(
self.zope_verify_activity_processing_url,
params={
'mode': 'count',
'retry': retry,
},
verify=False,
).json()['count']
if not count:
break
else:
self.assertEqual(count, 0)
class TestZopeMedusa(ZopeTestMixin, ERP5InstanceTestCase): class TestZopeMedusa(ZopeTestMixin, ERP5InstanceTestCase):
......
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