Skip to content

Rerun all failed tests, not only marked as fragile #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class TestSuite:
server for this suite, the client program to execute individual
tests and other suite properties. The server is started once per
suite."""

RETRIES_COUNT = 3

def get_multirun_conf(self, suite_path):
conf_name = self.ini.get('config', None)
if conf_name is None:
Expand Down Expand Up @@ -91,7 +94,7 @@ def __init__(self, suite_path, args):
self.args = args
self.tests = []
self.ini = {}
self.fragile = {'retries': 0, 'tests': {}}
self.fragile = {'retries': self.RETRIES_COUNT, 'tests': {}}
self.suite_path = suite_path
self.ini["core"] = "tarantool"

Expand Down Expand Up @@ -128,7 +131,7 @@ def __init__(self, suite_path, args):
if config.has_option("default", "fragile"):
fragiles = config.get("default", "fragile")
try:
self.fragile = json.loads(fragiles)
self.fragile.update(json.loads(fragiles))
if 'tests' not in self.fragile:
raise RuntimeError(
"Key 'tests' absent in 'fragile' json: {}"
Expand Down Expand Up @@ -288,7 +291,7 @@ def is_parallel(self):
return self.ini['is_parallel']

def fragile_retries(self):
return self.fragile.get('retries', 0)
return self.fragile['retries']

def show_reproduce_content(self):
return self.ini['show_reproduce_content']
Expand Down
19 changes: 12 additions & 7 deletions lib/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,25 @@ def run_loop(self, task_queue, result_queue):
'defined in suite.ini but this functionality '
'is dropped' % testname)
)
retries_left = self.suite.fragile_retries()
retries_left = self.suite.RETRIES_COUNT
if testname in self.suite.fragile['tests']:
retries_left = self.suite.fragile_retries()
# let's run till short_status became 'pass'
while short_status in (None, 'fail') and retries_left >= 0:
self.restart_server()
# print message only after some fails occurred
if short_status == 'fail':
color_stdout(
'Test "%s", conf: "%s"\n'
'\tfrom "fragile" list failed, rerunning ...\n'
% (task_id[0], task_id[1]), schema='error')
if testname not in self.suite.fragile['tests']:
color_stdout(
'Test "%s", conf: "%s"\n\tfailed, rerunning ...\n'
% (task_id[0], task_id[1]), schema='error')
else:
color_stdout(
'Test "%s", conf: "%s"\n'
'\tfrom "fragile" list failed, rerunning ...\n'
% (task_id[0], task_id[1]), schema='error')
# run task and save the result to short_status
short_status, duration = self.run_task(task_id)
if testname not in self.suite.fragile['tests']:
break
retries_left = retries_left - 1

result_queue.put(self.wrap_result(task_id, short_status, duration))
Expand Down