Replies: 1 comment 1 reply
-
I think, it is. It seems feasible: we can keep track of the current worker number in test-prof/lib/test_prof/recipes/minitest/before_all.rb Lines 27 to 36 in 9beed74 We can use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm refactoring a large Rails test suite (Minitest) and had some success with using the
before_all
hook to cut down on expensive object fabrication 👍However, when running the test suite now using Rails' build-in parallelization feature,
parallelize
, I get the message!!! before_all transaction has been already rollbacked and could work incorrectly
at the beginning. And indeed it seems that some test cases are failing due to that error.I'm running 8 parallel workers and I get this message 7 times, so I'm assuming that all 8 processes are using the same transaction and only one of them is able to roll it back successfully. Unfortunately, I don't know enough about how Rails
parallelize
works in conjunction with thebefore_all
hook. E.g. in my understanding, Rails creates a separate DB (+ connection?) for each worker, so how could they interfere with each other?Does anyone have experience with this and can tell me how to get it runnning or if it's even possible?
Beta Was this translation helpful? Give feedback.
All reactions