ruby on rails - Parallel Test Execution hangs indefinitely on webkit driver for rspec -
i'm running specs through parallel_tests on capybara-webkit driver. have next ruby environment:
ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.4.2]
running through rvm on gemset contains next (truncated capybara, rails, rspec, , parallel_tests relevance. if seeing larger swathe of gemset help, please allow me know):
*** local gems *** ... capybara (1.1.2) parallel_tests (0.8.12) rails (3.2.11) rspec (2.11.0)
when run test suit on single process rake spec
, of tests run completion. however, when runnning through parallel_tests, next happens:
8 processes 220 specs, ~ 27 specs per process
whereafter processes start coming back:
finished in 11 minutes 15.76 seconds finished in 11 minutes 28.89 seconds
but, after first 6 processes come back, parallel_spec hang indefinitely, never terminate, , never print output remaining 2 processes.
i'm on macbook pro running os x lion, 2.4ghz intel i7.
so question simple: why hanging, how can debug why hanging, , how can stop hanging , allow parallel_tests run completion?
there info missing regarding rspec configuration , library usage reply this. said, i've seen similar behavior in multi-threaded environment when running rspec integration specs.
the advice found on https://github.com/grosser/parallel_tests/wiki looks misleading in regard integration specs. trying rely on transaction
strategy of databasecleaner
or use_transactional_fixtures
guaranteed result in deadlocks non-blocking database adapter.
capybara spins multiple threads integration specs. when client , server threads effort interact same records @ same time you'll end timeouts or deadlocks. deadlock can cause suite run hang permanently until killed manually.
the solid configuration i've found prevent combination of sharing connection between activerecord
instances , judicious utilize of databasecleaner
.
# integration_spec_helper.rb rspec.configure |config| config.use_transactional_fixtures = false class activerecord::base class_attribute :shared_connection def self.connection self.shared_connection || retrieve_connection end end config.before |example| activerecord::base.shared_connection = activerecord::base.connection if capybara.current_driver == :webkit databasecleaner.strategy = :deletion else databasecleaner.strategy = :transaction end databasecleaner.start end config.after databasecleaner.clean end end
ruby-on-rails rspec webkit capybara parallel-testing
No comments:
Post a Comment