mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
DEV: Check for pending migrations before starting the turbo tests
This commit is contained in:
parent
d6aa92e98e
commit
23c5da4617
|
@ -1,10 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'open3'
|
||||
require 'fileutils'
|
||||
require 'json'
|
||||
require 'rspec'
|
||||
require 'rails'
|
||||
require File.expand_path('../../config/environment', __FILE__)
|
||||
|
||||
require 'parallel_tests'
|
||||
require 'parallel_tests/rspec/runner'
|
||||
|
|
|
@ -31,6 +31,8 @@ module TurboTests
|
|||
end
|
||||
|
||||
def run
|
||||
check_for_migrations
|
||||
|
||||
@num_processes = ParallelTests.determine_number_of_processes(nil)
|
||||
|
||||
tests_in_groups =
|
||||
|
@ -55,6 +57,21 @@ module TurboTests
|
|||
|
||||
protected
|
||||
|
||||
def check_for_migrations
|
||||
config =
|
||||
ActiveRecord::Base
|
||||
.configurations["test"]
|
||||
.merge("database" => "discourse_test_1")
|
||||
|
||||
conn = ActiveRecord::Base.establish_connection(config).connection
|
||||
begin
|
||||
ActiveRecord::Migration.check_pending!(conn)
|
||||
rescue ActiveRecord::PendingMigrationError
|
||||
puts "There are pending migrations, run rake parallel:migrate"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
def setup_tmp_dir
|
||||
begin
|
||||
FileUtils.rm_r('tmp/test-pipes')
|
||||
|
|
Loading…
Reference in New Issue
Block a user