-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop database cleaner and use rails system specs #898
Comments
FYI Have found an issue when working on this: mysql migration spec support. |
We have switched to system specs: #910 However dropping database cleaner altogether is tricky: migration specs rely on it, and there is a usage of it in Additionally just trying to replace the remaining usages of DatabaseCleaner with use_transactional_fixtures has some occasional random failures. https://app.travis-ci.com/github/thredded/thredded/builds/246469536 So parking this for now. |
I'm trying to drop database cleaner in a project that uses thredded, in favor of rails transactional system tests. Tests that create thredded objects have a tendancy to crash with malloc errors, deadlocks, or double free problems. What's different about thredded from the all the other rails gems we've used? Any tips on doing system tests with thredded objects in our own project? |
The only slightly unusual thing with Thredded is that the app uses threads to render some things in parallel (this is really a way of dealing with onebox). So maybe if your app has some problems with threading that might I've run Thredded-related tests in a project which uses transactional system tests successfully, including without database-cleaner |
We don't really use threads, in production anyway, but apparently rspec is, and when I remove database cleaner and turn on transactional tests, they hang only when using thredded. Is there a way to disable threads ? |
Upon further reflection, this kind of has me worried - I run production in a per-process environment, not expecting threads. Is this a possible time bomb under heavy load? |
You can disable threaded rendering like this: # config/initializers/thredded.rb
Thredded::CollectionToStringsWithCacheRenderer.render_threads = 1 The default is 50. Threads not working correctly likely indicates other issues in your application. |
I'm sorry to hijack this thread, it's the only thing remotely close to the problem I'm seeing. This didn't affect anything, but I got an error this time that makes me wonder about the interaction of rspec before actions, mysql, active job and thredded. The other interesting thing here is that we don't use active job, we use delayed_job gem so I don't think we have any configuration set for active job. It appears like active job is continuing to act on things after rspec has initiated the rollback.
|
Yes, that led me to look at your spec helper, and I added this to my spec helper:
And now the tests run to completion without deadlocks or other problems. |
(Yes, this is going quite off topic now, but continuing the discussion here anyway) It sounds like your ActiveJobs / DelayedJobs were running in your tests but in the background. This is not one of the default out of the box configs AFAIK for test setup - you either run them inline, or to queue them but either clear them or run them manually when you need to. Anyway this doesn't seem thredded-specific but glad it's solved for you. |
Split out from #894.
Now we are freed of pre rails 5.2 (#894), we no longer need database cleaner as we can use rails system specs.
This has multiple benefits (reliability, test flexibility, possibly speed).
The text was updated successfully, but these errors were encountered: