Skip to content

Commit 56deae6

Browse files
committed
Add repeat option to run untill tests fail
Add the `--repeat` command line option so each test should succeed `--repeat` times to pass. One may think of the option as a `--retries` analog, but instead of assuring that each test passes at least once, we require each test to pass every time. 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. Needed for tarantool/tarantool#6646
1 parent 5f82c70 commit 56deae6

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/options.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,22 @@ def __init__(self):
319319
Default: ${TEST_RUN_RETRIES} or 0.
320320
"""))
321321

322+
parser.add_argument(
323+
"--repeat",
324+
dest='repeat',
325+
default=env_int('TEST_RUN_REPEAT', 1),
326+
type=int,
327+
help=format_help(
328+
"""
329+
The number of times each test will be repeated.
330+
331+
Combining both non-trivial --retries and --repeat options
332+
values require each test to pass at least once in
333+
--retries runs --repeat times in a row.
334+
335+
Default: ${TEST_RUN_REPEAT} or 1.
336+
"""))
337+
322338
parser.add_argument(
323339
"-p", "--pattern",
324340
dest='pattern',

lib/worker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ def get_task_groups():
9696
"""
9797
suites = find_suites()
9898
res = collections.OrderedDict()
99+
repeat = Options().args.repeat
99100
for suite in suites:
100101
key = os.path.basename(suite.suite_path)
101102
gen_worker = functools.partial(Worker, suite) # get _id as an arg
102103
# Split stable and fragile tasks to two groups. Run stable
103104
# tasks in parallel with other ones. Run fragile tasks one
104105
# by one when all parallel tasks will be finished.
105-
stable_task_ids = [task.id for task in suite.stable_tests()]
106-
fragile_task_ids = [task.id for task in suite.fragile_tests()]
106+
stable_task_ids = [task.id for task in suite.stable_tests()] * repeat
107+
fragile_task_ids = [task.id for task in suite.fragile_tests()] * repeat
107108
if stable_task_ids:
108109
res[key] = {
109110
'gen_worker': gen_worker,

0 commit comments

Comments
 (0)