Skip to content

Commit dfcb8b4

Browse files
avtikhonTotktonada
authored andcommitted
Enable test reruns on failed fragiled tests
Added ability to set per suite in suite.ini configuration file 'retries' option, which sets the number of accepted reruns of the tests failed from 'fragile' list: fragile = { "retries": 10, "tests": { "bitset.test.lua": { "issues": [ "gh-4095" ], } }} Part of #189
1 parent a9e9a41 commit dfcb8b4

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/test_suite.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, suite_path, args):
8181
self.args = args
8282
self.tests = []
8383
self.ini = {}
84-
self.fragile = {'tests': {}}
84+
self.fragile = {'retries': 0, 'tests': {}}
8585
self.suite_path = suite_path
8686
self.ini["core"] = "tarantool"
8787

@@ -265,5 +265,8 @@ def run_test(self, test, server, inspector):
265265
def is_parallel(self):
266266
return self.ini['is_parallel']
267267

268+
def fragile_retries(self):
269+
return self.fragile.get('retries', 0)
270+
268271
def show_reproduce_content(self):
269272
return self.ini['show_reproduce_content']

lib/worker.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,21 @@ def run_loop(self, task_queue, result_queue):
326326
self.stop_worker(task_queue, result_queue)
327327
break
328328

329+
short_status = None
329330
result_queue.put(self.current_task(task_id))
330-
short_status = self.run_task(task_id)
331+
retries_left = self.suite.fragile_retries()
332+
# let's run till short_status became 'pass'
333+
while short_status != 'pass' and retries_left >= 0:
334+
# print message only after some fails occurred
335+
if short_status == 'fail':
336+
color_stdout(
337+
'Test "%s", conf: "%s"\n'
338+
'\tfrom "fragile" list failed, rerunning ...\n'
339+
% (task_id[0], task_id[1]), schema='error')
340+
# run task and save the result to short_status
341+
short_status = self.run_task(task_id)
342+
retries_left = retries_left - 1
343+
331344
result_queue.put(self.wrap_result(task_id, short_status))
332345
if not lib.Options().args.is_force and short_status == 'fail':
333346
color_stdout(

0 commit comments

Comments
 (0)