diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/tasks/gitlab/db_rake_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/tasks/gitlab/db_rake_spec.rb')
-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 |