Skip to content

Parallelize rspec tests#7972

Open
akarki2005 wants to merge 14 commits into
MarkUsProject:masterfrom
akarki2005:parallelize-rspec-tests
Open

Parallelize rspec tests#7972
akarki2005 wants to merge 14 commits into
MarkUsProject:masterfrom
akarki2005:parallelize-rspec-tests

Conversation

@akarki2005
Copy link
Copy Markdown
Contributor

@akarki2005 akarki2005 commented Jun 1, 2026

Proposed Changes

Adds the parallel_tests gem to run RSpec tests in parallel, reducing CI test suite runtime. Each parallel worker gets its own isolated test database using the TEST_ENV_NUMBER environment variable. System tests continue to run sequentially as they require a browser.

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration) X

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • [N/A] I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • [N/A] I have updated the project documentation, if applicable.
    • This is required for new features.
  • [N/A] If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

@akarki2005
Copy link
Copy Markdown
Contributor Author

akarki2005 commented Jun 1, 2026

Hi @david-yz-liu, I'm seeing that the CI run is failing due to the parallel_tests gem not getting installed properly - I made a commit to try and address this, but I think the bundle cache is stale, and I'm unable to change Gemfile.lock to re-trigger it. Are you able to clear the Actions cache for my PR? Thanks :)

@akarki2005 akarki2005 requested a review from david-yz-liu June 1, 2026 01:28
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

@akarki2005 I removed the gem cache and re-ran the tests. It looks like the gem installed correctly, but there's an issue with bundler using parallel_tests. See my comments for a suggested fix.

Comment thread .github/workflows/test_ci.yml Outdated
Comment thread .github/workflows/test_ci.yml Outdated
Comment thread Gemfile.lock Outdated
@akarki2005 akarki2005 force-pushed the parallelize-rspec-tests branch 2 times, most recently from be6a481 to c749258 Compare June 4, 2026 23:09
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Jun 4, 2026

Coverage Report for CI Build 27071576024

Coverage remained the same at 90.202%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 50140
Covered Lines: 46213
Line Coverage: 92.17%
Relevant Branches: 2230
Covered Branches: 1026
Branch Coverage: 46.01%
Branches in Coverage %: Yes
Coverage Strength: 126.26 hits per line

💛 - Coveralls

@akarki2005 akarki2005 requested a review from david-yz-liu June 5, 2026 00:21
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

@akarki2005 nice work! In addition to the inline comments I left, I think we can improve the GitHub Actions part a bit. Take a look at https://github.com/grosser/parallel_rails_example/blob/master/.github/workflows/test.yml, and in particular the store-runtime action. I think the goal of that is to cache the test logs so that the test parallelization is more balanced in future runs.

Comment thread Changelog.md Outdated
Comment thread Gemfile Outdated
@akarki2005 akarki2005 force-pushed the parallelize-rspec-tests branch from ee4164b to b70ff6f Compare June 6, 2026 19:22
@akarki2005 akarki2005 requested a review from david-yz-liu June 6, 2026 19:37
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

@akarki2005 the changes look good to me (and do seem to faithfully follow the parallel_tests example) but in the GitHub Actions flow, it looks like the tasks that involve deleting the cache are failing.

But also in the most recent test run I think there's an issue with redis as well with parallelization: https://github.com/MarkUsProject/Markus/actions/runs/27071576024/job/79960812268.

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.

3 participants