Reputation: 18418
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.
Upvotes: 15
Views: 1823
Reputation: 95
I agree that maybe having a separate script for groups of tests.
Something like:
/system_tests.sh
#!/bin/bash
set -e
# run tests
time npm test -- --maxWorkers=1
rspec --pattern "spec/system/*_spec.rb"
/all_other_tests.sh
#!/bin/bash
set -e
# run tests
time npm test -- --maxWorkers=8
rspec --p --exclude-pattern "spec/system/**"
Something along those lines, and then calling each script from your CI config. I'm guessing this question is long-answered, but perhaps the answer and some options to think about and config for oneself will be useful for someone else.
Upvotes: 0
Reputation: 9085
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
Upvotes: 3