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

Split tests for faster execution #22318

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Split tests for faster execution #22318

merged 6 commits into from
Jun 13, 2024

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Jun 5, 2024

Follow up of: mozilla/addons#14821

Description

This pull request splits the test_main into multiple groups to improve execution time. It introduces the pytest-split library to distribute the tests across multiple processes. This change will significantly reduce the overall test duration and improve the efficiency of the testing process.

Context

We rely on pytest markers to identify tests that should run in a particular group make test_main ignores all of the markers we use and can thus be considered the "standard" or "main" tests. The split is only applying to those tests as the largest group with 7k+ tests. Even splitting this group with -n auto results in 4 cores running 7k tests in roughly 15 or so minutes. by splitting using pytest-split we can get the time down to almost any number we want.

Currently the split is somewhat arbitrarily set to 14 but we could even add logic (another PR) to determine the appropriate split based on how many tests there are and how big we want the groups to be. Say no more than 500 tests in a group.

This gives us a lot of control on the time it takes to run the longest test job and let's us scale without creeping up on the runtime.

@KevinMind KevinMind force-pushed the parallel-tests branch 30 times, most recently from a10509b to fdb5987 Compare June 6, 2024 17:33
@KevinMind KevinMind force-pushed the parallel-tests branch 2 times, most recently from 5f02e40 to a505868 Compare June 11, 2024 14:32
@KevinMind

This comment was marked as outdated.

@KevinMind KevinMind force-pushed the parallel-tests branch 2 times, most recently from 986a556 to 7cf2af0 Compare June 11, 2024 17:44
@KevinMind KevinMind force-pushed the parallel-tests branch 3 times, most recently from b19d037 to 586926b Compare June 12, 2024 13:45
@KevinMind KevinMind marked this pull request as ready for review June 12, 2024 14:26
@KevinMind KevinMind requested a review from eviljeff June 12, 2024 15:27
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@KevinMind KevinMind requested a review from diox June 12, 2024 16:24
@KevinMind

This comment was marked as outdated.

@diox

This comment was marked as outdated.

@diox

This comment was marked as outdated.

@KevinMind

This comment was marked as outdated.

@diox

This comment was marked as outdated.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@KevinMind KevinMind merged commit 8fc73b3 into master Jun 13, 2024
27 checks passed
@KevinMind KevinMind deleted the parallel-tests branch June 13, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants