You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run the test suite by using rspec, I'm getting everything green, but when I use parallel_spec, I'm getting random errors.
In my test setup, I'm using database cleaner and transactional fixtures. After running bisect I was able to identify tests that are failing more precisely. The main issue happens after I added to my database configuration reader and replicas. The transaction on test side of things has all the data, but when I access the application side, there are no data. This doesn't happen on every file. For example now I have 2091 test cases, but only 7 of them are random failures.
I went back to the database settings and change the code to following:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
connects_to database: { writing: :primary, reading: :primary_replica } unless Rails.env.test?
connects_to database: { writing: :primary, reading: :primary } if Rails.env.test?
end
But this didn't help as I expected. Could this be a parallel_spec bug or Rails bug or am I doing something wrong?
The text was updated successfully, but these errors were encountered:
database cleaner should not be needed when using transactional fixtures ... so try removing to simplify setup
run with --verbose to get a printout of the the files parallel_rspec runs and run them manually ... that should reproduce the issue and you can bisect from there
If I run the test suite by using rspec, I'm getting everything green, but when I use parallel_spec, I'm getting random errors.
In my test setup, I'm using database cleaner and transactional fixtures. After running bisect I was able to identify tests that are failing more precisely. The main issue happens after I added to my database configuration reader and replicas. The transaction on test side of things has all the data, but when I access the application side, there are no data. This doesn't happen on every file. For example now I have 2091 test cases, but only 7 of them are random failures.
I went back to the database settings and change the code to following:
But this didn't help as I expected. Could this be a parallel_spec bug or Rails bug or am I doing something wrong?
The text was updated successfully, but these errors were encountered: