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 tests in parallel #1549

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Run tests in parallel #1549

wants to merge 1 commit into from

Conversation

harigopal
Copy link
Member

@pupilfirst/developers This adds the parallel_tests gem to run Rspec tests in parallel with multiple databases. On my 8-core laptop, this runs with 16 processes by default and finishes all tests in approx 2:50 (m:ss). Manually setting the number of processes to 8 reduces memory pressure somewhat, and still finishes in 3:10. So it seems hyper-threading doesn't help too much.

To run tests in parallel on this branch, do:

# Create the parallel databases (equal to number of logical processors)
bundle exec rails parallel:create

# Load schema into all of these databases
bundle exec rails parallel:prepare

# Run the tests. I had to pass RAILS_ENV=tests to get this to work.
RAILS_ENV=test bundle exec rails parallel:spec

# Or to limit the number of processes to 8...
RAILS_ENV=test bundle exec "rails parallel:spec[8]"

A few specs are failing for me (2 to 3).

Running failing specs using bundle exec rspec --only-failures is also resulting in failures, so this needs looking into.

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Check if route, query, or mutation authorization looks correct.
    • Add tests for authorization, if required.
  • Ensure that UI text is kept in I18n files.
  • Update developer and product docs, where applicable.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Check if new tables or columns that have been added need to be handled in the following services:
    • Users::DeleteAccountService
    • Courses::CloneService
    • Courses::DeleteService
    • Courses::DemoContentService
    • Levels::CloneService
    • Schools::DeleteService
  • Check if changes in packaged components have been published to npm.
  • Add development seeds for new tables.
  • If the updates involve Graph mutations ensure that the files are migrated to the new approach without a mutator.
  • If the updates involve adding a new table ensure that rate limiting is added and documented in the docs/developers/rate_limiting.md file.

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.

None yet

1 participant