Are we able to run our Rails tests in parallel?

Hey all,

I noticed rails 6 supports parallel testing and I know devs have been coming up with homemade solutions to paralelize Rails tests even before that. My understanding is Rails 6 creates a database per worker, which iirc was the concern when this was brought up years ago.

Aside from time and resources, is there anything stopping us from running tests in parallel? Our Rails tests are by far the longest tests in both Katello and Foreman and I think any improvement in time there would be a big improvement.

I’m sure we would all appreciate Katello tests that didn’t take an hour :stuck_out_tongue_winking_eye:

IIRC @Shimon_Shtein did some attempt to get them to run in parallel a couple of years ago and hit some issues. that might no longer be the case with rails 6, but i’ll let him comment to that.

A lot of things have been improved since I tried to run tests in parallel. I think it’s worth a shot.
Mostly I got problems running integration tests in parallel, but I think running those in a different jenkins task/GH action in parallel to other tests will do.
Most of problems I hit were isolation problems - when one test unintentionally was relying on other tests. I think we solved a lot of issues along the way, so it can work now.

I do wonder how much performance increase we will get from this though. It really depends if we have idle cores during tests. I think that now that we have more resources in GH actions, maybe it would make more sense parallelizing different types of workloads as parallel actions.

Thanks for sharing! Sounds like its worth digging into and maybe getting some benchmarks to see if there is improvement enough to make it worth our time.

I have a draft PR for a Katello rails tests GH action - it works without parallel workers, but it errors when I used 2 workers. I didn’t get a chance to look into it closely. If anyone wants to use this action to mess around with parallel tests and experiment further, feel free to! :slight_smile: