Skip to content
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

Run unit tests in parallel #1625

Merged
merged 14 commits into from Nov 7, 2021
Merged

Run unit tests in parallel #1625

merged 14 commits into from Nov 7, 2021

Conversation

Kami
Copy link
Member

@Kami Kami commented Nov 6, 2021

This PR attempts to run unit tests in parallel using pytest-xdist plugin.

To avoid issues with some of the test functions not being "cross process safe" we run all the tests in a single test file in the same worker process.

Locally (with 16 cores) unit tests now finish ~5-10x faster, but it depends on number of available cores.

@Kami Kami added the tests label Nov 6, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2021

Codecov Report

Merging #1625 (b0eeb3f) into trunk (748dc59) will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk    #1625      +/-   ##
==========================================
- Coverage   83.16%   83.15%   -0.01%     
==========================================
  Files         397      397              
  Lines       86545    86542       -3     
  Branches     9197     9197              
==========================================
- Hits        71979    71968      -11     
- Misses      11436    11444       +8     
  Partials     3130     3130              
Impacted Files Coverage Δ
libcloud/test/test_utils.py 95.18% <ø> (-0.13%) ⬇️
libcloud/test/storage/test_local.py 91.51% <50.00%> (+0.02%) ⬆️
libcloud/test/loadbalancer/test_brightbox.py 91.04% <100.00%> (+0.13%) ⬆️
libcloud/utils/connection.py 11.11% <0.00%> (-88.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 748dc59...b0eeb3f. Read the comment docs.

scenarios when running tests in standalone fashion (so compute test
didn't set token value on which test relies on).
@Kami
Copy link
Member Author

Kami commented Nov 6, 2021

This change uncovered some issues with some test files relying on shared state (aka when running all the test cases together in the same process some other import unintentionally setting some state which test relies on) which I'm trying to fix.

@Kami
Copy link
Member Author

Kami commented Nov 6, 2021

On CI, tests now finish 30-40 seconds faster (2 min 20 vs 1 min 40). Not a massive speed up, but GHA runner likely doesn't have as many cores and it's likely more heavily over provisioned with other jobs.

@asfgit asfgit merged commit b0eeb3f into apache:trunk Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants