Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Paralellize the integration tests #62

Merged
merged 4 commits into from
May 30, 2018
Merged

Conversation

hroncok
Copy link
Member

@hroncok hroncok commented May 28, 2018

This has been a horror.

hroncok added 3 commits May 28, 2018 18:13
This is an attempt to fix fedora-python#45

It does the following:

 * uses pytest-xdist to paralellize the tests (3 workers)
 * utilizes custom scheduler that splits the tests according to the fixture name
   * this is needed not to use 1 fixture on multiple workers
     see pytest-dev/pytest-xdist#18
 * use parametrize an all integration tests to enable our hackish scheduler
 * mock now creates the roots in pwd (not to pollute the filesystem on /)
   * note that the roots can take several GBs
@hroncok
Copy link
Member Author

hroncok commented May 28, 2018

Even on Travis Ci this is slightly faster. On my machine, it got from ~9 minutes to ~4.

pyyaml
basepython = python3
commands = python -m pytest -v {posargs} test/integration
commands = python -m pytest -v -n3 {posargs} test/integration
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using more is very heavy on disc usage.


config_opts['chroot_setup_cmd'] = 'install ansible dnf'
config_opts['use_host_resolv'] = True
config_opts['rpmbuild_networking'] = True
config_opts['use_nspawn'] = False
config_opts['root'] = 'fedora-27-x86_64-taskotron'
config_opts['root'] = 'taskotron-python-versions-master'
config_opts['plugin_conf']['root_cache_opts']['dir'] = "%(cache_topdir)s/taskotron-python-versions/root_cache/"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes sure all our mock roots share one root cache

@hroncok
Copy link
Member Author

hroncok commented May 29, 2018

Added an unrelated hotfix. But I was lazy to rebase this on top of it.

@hroncok
Copy link
Member Author

hroncok commented May 29, 2018

@kparal Could you please just tell me whether this works for you and whether it's at least a bit faster?

Copy link
Collaborator

@irushchyshyn irushchyshyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried this change on my machine, and it works, the tests run fine. The improvement for integration tests was very slight, from ~8 min to ~7 min.

@hroncok
Copy link
Member Author

hroncok commented May 30, 2018

Thanks @irushchyshyn what happens if you run it for the second time?

@irushchyshyn
Copy link
Collaborator

what happens if you run it for the second time?

It was the second time. For the first time it took ~10 mins for integration tests. But I realised I was running it with only 1 CPU 😊

I increased the number of CPU to 4 (I currently run Fedora in a VM) and it took ~4 min for integration tests (compared to ~8 mins on develop branch ) Twice as fast 👍

@kparal
Copy link
Collaborator

kparal commented May 30, 2018

Before patch:

real	10m4.292s
user	7m16.541s
sys	0m30.759s

That currently fails in test_py3_support_failed[bucky] and test_artifact_contains_py3_support_and_looks_as_expected.

After patch:

real	5m56.814s
user	12m43.871s
sys	0m54.623s

and

real	4m3.688s
user	8m51.484s
sys	0m45.015s

No failures.

@hroncok hroncok merged commit 28bc649 into fedora-python:develop May 30, 2018
@hroncok hroncok deleted the xdist branch May 30, 2018 12:44
@hroncok
Copy link
Member Author

hroncok commented May 30, 2018

Thank you both.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants