From f3f140fbb35cd5a86c010ec27831222bae00de33 Mon Sep 17 00:00:00 2001 From: Mustafa Kemal GILOR Date: Wed, 22 May 2024 12:39:30 +0200 Subject: [PATCH] tox.ini/stestr: remove "--serial" to enable test parallelization (#880) Having "--serial" impedes the parallelization and thus affects the unit test execution speed greatly. We have no real reason to have "--serial" in place, it both makes the test execution slower and possibly hides hidden dependencies between the test cases. The unit tests must be able to run in parallel and should be indifferent to the ordering. This patch removes the "--serial" argument, adds "--random" and "--slowest" arguments, which randomizes the order of the test cases and reports the slowest test cases respectively. Below are the run time differences between the baseline(main) and this patch(stestr-parallel): Command `tox`: --------------------------------------------------- main: ``` py3: OK (66.73=setup[0.03]+cmd[0.06,66.64] seconds) ... congratulations :) (111.38 seconds) ``` stestr-parallel: ``` py3: OK (10.21=setup[0.03]+cmd[0.05,10.12] seconds) ... congratulations :) (53.62 seconds) ``` results: 6.53x improvement in "py3" runtime 2.07x improvement in total runtime Command `tox --parallel`: --------------------------------------------------- main: ``` py3: OK (68.94=setup[0.17]+cmd[0.05,68.71] seconds) ... congratulations :) (71.23 seconds) ``` stestr-parallel: ``` py3: OK (12.12=setup[0.21]+cmd[0.06,11.86] seconds) ... congratulations :) (41.61 seconds) ``` results: 5.68x improvement in "py3" runtime 1.71x improvement in total runtime Signed-off-by: Mustafa Kemal Gilor --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 268db1846..c20f4ffa1 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ deps = -r{toxinidir}/test-requirements.txt commands = coverage erase - stestr run --serial --test-path {[testenv]unit_tests} {posargs} + stestr run --random --slowest --test-path {[testenv]unit_tests} {posargs} [testenv:pep8] allowlist_externals = flake8