diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-23 21:10:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-23 21:10:18 +0300 |
commit | bc62085601fa730985ea84f88a96c39d870c6ea6 (patch) | |
tree | 09ab45c32cb111607db05f121ec38b9b8184c64c /spec/tasks | |
parent | 7e1e45d40a2312e20893ccfc6e7e5dfad6cf7b1c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/db_rake_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index d1f4a12d8fc..1392bae055a 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -348,6 +348,26 @@ RSpec.describe 'gitlab:db namespace rake task' do end end + describe '#execute_batched_migrations' do + subject { run_rake_task('gitlab:db:execute_batched_migrations') } + + let(:migrations) { create_list(:batched_background_migration, 2) } + let(:runner) { instance_double('Gitlab::Database::BackgroundMigration::BatchedMigrationRunner') } + + before do + allow(Gitlab::Database::BackgroundMigration::BatchedMigration).to receive_message_chain(:active, :queue_order).and_return(migrations) + allow(Gitlab::Database::BackgroundMigration::BatchedMigrationRunner).to receive(:new).and_return(runner) + end + + it 'executes all migrations' do + migrations.each do |migration| + expect(runner).to receive(:run_entire_migration).with(migration) + end + + subject + end + end + def run_rake_task(task_name, arguments = '') Rake::Task[task_name].reenable Rake.application.invoke_task("#{task_name}#{arguments}") |