grosser / parallel_tests

Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
3.38k stars 495 forks source link

Parallel:prepare task uses deprecated db:test:prepare for sql-based schemas #455

Open mennomenno opened 9 years ago

mennomenno commented 9 years ago

The parallel:prepare task invokes db:test:prepare when database schema has been dumped in sql. See lib/parallel_tests/tasks.rb:93

# there is no separate dump / load for schema_format :sql -> do it safe and slow
args = args.to_hash.merge(:non_parallel => true) # normal merge returns nil
taskname = Rake::Task.task_defined?('db:test:prepare') ? 'db:test:prepare' : 'app:db:test:prepare'
ParallelTests::Tasks.run_in_parallel("rake #{taskname}", args)

In Rails 4 this triggers a deprecation warning:

WARNING: db:test:prepare is deprecated. The Rails test helper now maintains your test schema automatically, see the release notes for details.

For details see https://github.com/rails/rails/pull/13528

grosser commented 9 years ago

Yeah these warnings are annoying, a PR to silence them (silence_warnings{ xxx } since I don't think it got dropped in rails 5) would be great.

I found the automatic migrator to not be very reliable, when messing with migrations / schema you can end up in bad states. Prepare is my 'get me back to safety' hatch and a nice tool to get a level playing field when debugging crazy bugs.

The automated migrator should be working on separate test databases, so there might be no need to call prepare as part of the default setup, but not sure ...

Confusion commented 8 years ago

Could we replace the db:test:prepare by a db:reset RAILS_ENV=test?

grosser commented 8 years ago

possible ... need to dig through the sources a bit to see if they are similar ... ideally stay as close to what rails does as possible to avoid weird edge-cases :)

On Mon, Dec 28, 2015 at 4:06 PM, Ivo Wever notifications@github.com wrote:

Could we replace the db:test:prepare by a db:reset RAILS_ENV=test?

— Reply to this email directly or view it on GitHub https://github.com/grosser/parallel_tests/issues/455#issuecomment-167517921 .