freeipa/ipatests/pytest_ipa
Stanislav Levin a2d4e2a61f Make use of Azure Pipeline slicing
The unit tests execution time within Azure Pipelines(AP) is not
balanced. One test job(Base) takes ~13min, while another(XMLRPC)
~28min. Fortunately, AP supports slicing:

> An agent job can be used to run a suite of tests in parallel. For
example, you can run a large suite of 1000 tests on a single agent.
Or, you can use two agents and run 500 tests on each one in parallel.
To leverage slicing, the tasks in the job should be smart enough to
understand the slice they belong to.

>The step that runs the tests in a job needs to know which test slice
should be run. The variables System.JobPositionInPhase and
System.TotalJobsInPhase can be used for this purpose.

Thus, to support this pytest should know how to split the test suite
into groups(slices). For this, a new internal pytest plugin was added.

About plugin.
- Tests within a slice are grouped by test modules because not all of
the tests within the module are independent from each other.
- Slices are balanced by the number of tests within test module.
- To run some module within its own environment there is a dedicated
slice option (could help with extremely slow tests)

Examples.
- To split `test_cmdline` tests into 2 slices and run the first one:

ipa-run-tests --slices=2 --slice-num=1 test_cmdline

- To split tests into 2 slices, then to move one module out to its own slice
and run the second one:

ipa-run-tests --slices=2 --slice-dedicated=test_cmdline/test_cli.py \
    --slice-num=2 test_cmdline

Fixes: https://pagure.io/freeipa/issue/8008
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2019-07-16 13:23:21 +03:00
..
integration ipatests: new test for trust with partially unreachable AD topology 2019-07-15 14:35:51 +02:00
__init__.py Rename pytest_plugins to ipatests.pytest_ipa 2018-08-02 17:07:43 +02:00
additional_config.py Rename pytest_plugins to ipatests.pytest_ipa 2018-08-02 17:07:43 +02:00
beakerlib.py Rename pytest_plugins to ipatests.pytest_ipa 2018-08-02 17:07:43 +02:00
declarative.py Rename pytest_plugins to ipatests.pytest_ipa 2018-08-02 17:07:43 +02:00
nose_compat.py Rename pytest_plugins to ipatests.pytest_ipa 2018-08-02 17:07:43 +02:00
slicing.py Make use of Azure Pipeline slicing 2019-07-16 13:23:21 +03:00