diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-10 00:07:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-10 00:07:53 +0300 |
commit | b558e1ad8f1d2d52e0c88ad712cd3d567cf52e10 (patch) | |
tree | 5fc6b81818c0af3aefd85816aa3026b26515615e /spec/tasks | |
parent | b031a57ae71b1fc61782b891d2a31852ab87e7f3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r-- | spec/tasks/gitlab/db_rake_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index 73f3b55e12e..e340d568269 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -697,6 +697,34 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout do run_rake_task('gitlab:db:migration_testing:sample_background_migrations', '[100]') end end + + describe '#sample_batched_background_migrations' do + let(:batched_runner) { instance_double(::Gitlab::Database::Migrations::TestBatchedBackgroundRunner) } + + it 'delegates to the migration runner for the main database with a default sample duration' do + expect(::Gitlab::Database::Migrations::Runner).to receive(:batched_background_migrations) + .with(for_database: 'main').and_return(batched_runner) + expect(batched_runner).to receive(:run_jobs).with(for_duration: 30.minutes) + + run_rake_task('gitlab:db:migration_testing:sample_batched_background_migrations') + end + + it 'delegates to the migration runner for a specified database with a default sample duration' do + expect(::Gitlab::Database::Migrations::Runner).to receive(:batched_background_migrations) + .with(for_database: 'ci').and_return(batched_runner) + expect(batched_runner).to receive(:run_jobs).with(for_duration: 30.minutes) + + run_rake_task('gitlab:db:migration_testing:sample_batched_background_migrations', '[ci]') + end + + it 'delegates to the migration runner for a specified database and sample duration' do + expect(::Gitlab::Database::Migrations::Runner).to receive(:batched_background_migrations) + .with(for_database: 'ci').and_return(batched_runner) + expect(batched_runner).to receive(:run_jobs).with(for_duration: 100.seconds) + + run_rake_task('gitlab:db:migration_testing:sample_batched_background_migrations', '[ci, 100]') + end + end end describe '#execute_batched_migrations' do |