Skip to content

Add repeat option to run untill tests fail #456

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
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
16 changes: 16 additions & 0 deletions lib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,22 @@ def __init__(self):
Default: ${TEST_RUN_RETRIES} or 0.
"""))

parser.add_argument(
"--repeat",
dest='repeat',
default=env_int('TEST_RUN_REPEAT', 1),
type=int,
help=format_help(
"""
The number of times each test will be repeated.

Combining both non-trivial --retries and --repeat options
values require each test to pass at least once in
--retries runs --repeat times in a row.

Default: ${TEST_RUN_REPEAT} or 1.
"""))

parser.add_argument(
"-p", "--pattern",
dest='pattern',
Expand Down
5 changes: 3 additions & 2 deletions lib/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ def get_task_groups():
"""
suites = find_suites()
res = collections.OrderedDict()
repeat = Options().args.repeat
for suite in suites:
key = os.path.basename(suite.suite_path)
gen_worker = functools.partial(Worker, suite) # get _id as an arg
# Split stable and fragile tasks to two groups. Run stable
# tasks in parallel with other ones. Run fragile tasks one
# by one when all parallel tasks will be finished.
stable_task_ids = [task.id for task in suite.stable_tests()]
fragile_task_ids = [task.id for task in suite.fragile_tests()]
stable_task_ids = [task.id for task in suite.stable_tests()] * repeat
fragile_task_ids = [task.id for task in suite.fragile_tests()] * repeat
if stable_task_ids:
res[key] = {
'gen_worker': gen_worker,
Expand Down
Loading