summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-07-01 13:18:54 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-07-01 13:18:54 +0000
commit5c02be6ca3846f047682b68844155529b8a44445 (patch)
tree93d07cad9df49dc1d90b481e249238d98ed71097
parent9b005f40ef6d592302a65951ad4cbabc0a8e9294 (diff)
parentfbd987a97717d14a23b39d69aae910c9e55a8a93 (diff)
downloadgitlab-ce-5c02be6ca3846f047682b68844155529b8a44445.tar.gz
Merge branch 'test_schema_version_check_directly' into 'master'
Test schema_version_check directly Closes #63913 See merge request gitlab-org/gitlab-ce!30209
-rw-r--r--spec/tasks/migrate/schema_check_rake_spec.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/spec/tasks/migrate/schema_check_rake_spec.rb b/spec/tasks/migrate/schema_check_rake_spec.rb
index 72fb1363dfb..1097a43cd8a 100644
--- a/spec/tasks/migrate/schema_check_rake_spec.rb
+++ b/spec/tasks/migrate/schema_check_rake_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
require 'rake'
-describe 'schema_version_check rake task', :quarantine do
+describe 'schema_version_check rake task' do
include StubENV
before :all do
@@ -15,8 +15,6 @@ describe 'schema_version_check rake task', :quarantine do
end
before do
- # Stub out db tasks
- allow(ActiveRecord::Tasks::DatabaseTasks).to receive(:migrate).and_return(true)
allow(ActiveRecord::Migrator).to receive(:current_version).and_return(Gitlab::Database::MIN_SCHEMA_VERSION)
# Ensure our check can re-run each time
@@ -24,23 +22,23 @@ describe 'schema_version_check rake task', :quarantine do
end
it 'allows migrations on databases meeting the min schema version requirement' do
- expect { run_rake_task('db:migrate') }.not_to raise_error
+ expect { run_rake_task('schema_version_check') }.not_to raise_error
end
it 'raises an error when schema version is too old to migrate' do
allow(ActiveRecord::Migrator).to receive(:current_version).and_return(25)
- expect { run_rake_task('db:migrate') }.to raise_error(RuntimeError, /current database version is too old to be migrated/)
+ expect { run_rake_task('schema_version_check') }.to raise_error(RuntimeError, /current database version is too old to be migrated/)
end
it 'skips running validation when passed the skip env variable' do
stub_env('SKIP_SCHEMA_VERSION_CHECK', 'true')
allow(ActiveRecord::Migrator).to receive(:current_version).and_return(25)
- expect { run_rake_task('db:migrate') }.not_to raise_error
+ expect { run_rake_task('schema_version_check') }.not_to raise_error
end
it 'allows migrations on fresh databases' do
allow(ActiveRecord::Migrator).to receive(:current_version).and_return(0)
- expect { run_rake_task('db:migrate') }.not_to raise_error
+ expect { run_rake_task('schema_version_check') }.not_to raise_error
end
def run_rake_task(task_name)