Is hydra expected to provide any benefit without using RSpec or Factory Girl? #33
Comments
Actually, I prefer plain old test unit, and it should give you a speedup! I don't usually use fixtures, but if the tests pass then you're fine. It's probably database deadlocks that are slowing you down. Try running the hydra task with verbose mode enabled. Paste that in here and I'll take a look. https://github.com/ngauthier/hydra/wiki/Frequently-Asked-Questions -Nick |
Hi Nick. Thanks for your reply. As you predicted, it is a problem with deadlock. An example from running in verbose mode:
I added the call to use_concurrent_connections but haven't seen any changes. To confirm what I read in the FAQ, I appended this to test/test_helper.rb:
When the raise is uncommented all the tests fail, so I'm confident that my code is being reached. Anything else I should try? |
as of right now hydra doesn't support using multiple databases, so I think you're stuck :-( You can try setting "autosort" to false in the task, and ordering your tests as best you can to minimize deadlock. You can also move the "naughty" tests to a separate task, and set "serial" to true in that task to force them to run by themselves. Sorry. |
Thanks Nick. I dug a little deeper using test_benchmark (https://github.com/timocratic/test_benchmark) and discovered that some of the biggest offenders don't touch the DB. I'll try grouping my tests into those which can be run in parallel and those that cannot. |
Forgive the dumb question but I haven't been able to find an answer online. Using traditional fixtures and Test::Unit I can run unit tests in 1 minute 16 seconds:
I installed the hydra gem and added the following to my Rakefile:
My config/hydra.yml looks like this:
Running my unit tests inside hydra results in a slowdown:
I'm wondering if this is because I'm not using RSpec or Factory Girl or Cucumber or anything else that the cool kids are using these days. The database is Postgres and I have transaction fixtures and concurrent connections enabled. Any help would be appreciated. Thanks!
Brian
The text was updated successfully, but these errors were encountered: