rubyatscale / packs-rails

packs-rails establishes and implements a set of conventions for splitting up large monoliths.
MIT License
268 stars 26 forks source link

parallel_tests gem support #30

Closed oleg-vinted closed 2 years ago

oleg-vinted commented 2 years ago

parallel_tests gem allows running tests using multiple processes to speed up the process. The problem is that parallel_tests has its own spec discovery mechanism, so Stimpack's RSpec integration doesn't do anything.

One workaround we found is passing the name of the package directory through the fourth argument to parallel:spec works:

RAILS_ENV=test bundle exec rake 'parallel:spec[2,,,packs]'

It would be nice to find a better way to integrate into parallel_tests.

alexevanczuk commented 2 years ago

In the Ruby/Rails modularity slack server another user recommends an approach with parallel_tests:

https://rubymod.slack.com/archives/C02TLU33RNW/p1662063968955199?thread_ts=1660063285.310539&cid=C02TLU33RNW (Here's an invite link to the server for anyone who is not in it.)

Would this work for you?

I think it would be interesting to allow Stimpack to permit plugins so users can add their own pack-based tooling integrations, but we're generally hesitant about adding too many integrations with a lot of tools that may not be applicable to all users.

oleg-vinted commented 2 years ago

Copying the solution over from Slack:

RAILS_ENV=test bundle exec parallel_test spec packs/**/spec -n 12 -t rspec

Yes, this also works, and looks more elegant. 👍

but we're generally hesitant about adding too many integrations

This makes sense. With parallel_tests in particular I don't think there's a clean way to hook into it, other than monkey patching. parallel_tests needs to add support for integrations on their end.

Either way, what we could do for now is to document the best known integration methods in README, and close the issue. What do you think?

alexevanczuk commented 2 years ago

That sounds great to me. I'm thinking an Ecosystem and Integrations section in the README where we can list recommended approaches for integrating with other tools!

iMacTia commented 2 years ago

I had a similar issue with Knapsack, another popular library for parallising specs execution. I'll create a PR to add this new section to the README and include both solutions 👍