DEV: correct parallel specs rake tasks

This used to work due to side effects.

`rake parallel:migrate` used to work very inconsistently and would only migrate
some of the databases.

This introduces the recommended change to db.yml so the correct database is
found based off TEST_ENV_NUMBER if for some reason we did not set it using
RAILS_DB

Also avoids a bunch of schema dumping which is not needed when migrating
parallel specs



DB number 1 is very odd cause for whatever reason parallel spec is not
setting it.
This commit is contained in:
Sam Saffron
2019-12-31 14:07:44 +11:00
parent f04f6cbf01
commit 412e1ebbe2
3 changed files with 22 additions and 4 deletions
+6 -3
View File
@@ -68,20 +68,23 @@ end
# we need to run seed_fu every time we run rake db:migrate
task 'db:migrate' => ['load_config', 'environment', 'set_locale'] do |_, args|
ActiveRecord::Tasks::DatabaseTasks.migrate
Rake::Task['db:_dump'].invoke
if !Discourse.is_parallel_test?
Rake::Task['db:_dump'].invoke
end
SeedFu.seed(DiscoursePluginRegistry.seed_paths)
unless Discourse.skip_post_deployment_migrations?
if !Discourse.skip_post_deployment_migrations?
puts
print "Optimizing site icons... "
SiteIconManager.ensure_optimized!
puts "Done"
end
if MultisiteTestHelpers.load_multisite?
if !Discourse.is_parallel_test? && MultisiteTestHelpers.load_multisite?
system("RAILS_DB=discourse_test_multisite rake db:migrate")
end
end