-
Notifications
You must be signed in to change notification settings - Fork 485
Description
This one is hard to reproduce, might not have anything to do with DC but I tracked the issue down to the DC configuration/behavior.
I have a code that runs a couple of operations on threads, using concurrent-ruby's Future. It goes along these lines:
Rails.application.executor.wrap do
future = Concurrent::Future.execute do
Rails.application.executor.wrap(executor: executor) do
operation_that_finds_a_user_on_db
end
end
values = ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
future.value!
end
endwhen I'm running controller specs that invoke this part of code, they fail and the exception is that there are no users on the database anymore. I tracked the issue down to DC doing a clean-up.
It looks like DC is running even though Futures are not finished yet. I can't say that this is an issue with DC but I figure that this could be a starting point
Here is my whole config file
RSpec.configure do |config|
DatabaseCleaner.allow_remote_database_url = true if Rails.env.test?
config.before(:suite) do
DatabaseCleaner.clean_with(:deletion)
end
config.before do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :deletion
end
config.before do
DatabaseCleaner.start
end
config.after do
DatabaseCleaner.clean
end
endDoes this make any sense?
Edit: I noticed that changing the strategy from transaction to deletion or truncation worked but the tests got SO much slower that it's not even an option