Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Rails test parallelization *just* for system tests?

I'm finding that the default test parallelization makes chromedriver tests highly unreliable. But I'd like to keep other tests parallel.

I've tried this in application_system_test_case.rb:

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
  parallelize(workers: 1)
  # ...
end

...but it doesn't seem to override the default.

I'm currently using:

PARALLEL_WORKERS=1 rails test:system

...but I'm looking for a way to hardcode this into the project in such a way that someone else doesn't have to "just know" to always set that env var for system tests.

like image 613
Avdi Avatar asked Dec 19 '25 05:12

Avdi


1 Answers

I would run two separate process, e.g. a bin/test with:

#!/bin/bash

set -e

rails test test/models test/controllers ...

PARALLEL_WORKERS=1 rails test:system

Or maybe fix the root cause of the flakiness of the system tests running in parallel

like image 146
Dorian Avatar answered Dec 21 '25 18:12

Dorian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!