I have this in as a “how do I do this?” question over here: How to disable test parallelization *just* for system tests?
But it’s actually kind of a newbie WTF as welll. I’m running the out-of-box
rails generate scaffold-generated system tests for a resource using chromedriver, and at least 50% of the time one or more tests fail. Running with
PARALLEL_WORKERS=1 fixes it.
Interestingly this is not just a Rails problem. When I was playing with writing a web scraper in Rust a while back, Rust’s test parallelization caused ALLLLLLLL kinds of failures. The root cause there was that the
chromedriver process was a contended resource between threads.
I have encountered this WTF. I found running
with: :threads seemed to resolve it.
parallelize(workers: :number_of_processors, with: :threads)