diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb index 83c0275a870..983f482d464 100644 --- a/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb +++ b/spec/lib/gitlab/database/background_migration/batched_migration_wrapper_spec.rb @@ -38,10 +38,11 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' batch_column: 'id', sub_batch_size: 1, pause_ms: pause_ms, + job_arguments: active_migration.job_arguments, connection: connection) .and_return(job_instance) - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) perform end @@ -49,7 +50,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' it 'updates the tracking record in the database' do test_metrics = { 'my_metrics' => 'some value' } - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(job_instance).to receive(:batch_metrics).and_return(test_metrics) freeze_time do @@ -78,7 +79,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' it 'increments attempts and updates other fields' do updated_metrics = { 'updated_metrics' => 'some_value' } - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(job_instance).to receive(:batch_metrics).and_return(updated_metrics) freeze_time do @@ -97,7 +98,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the migration job does not raise an error' do it 'marks the tracking record as succeeded' do - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) freeze_time do perform @@ -110,7 +111,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' end it 'tracks metrics of the execution' do - expect(job_instance).to receive(:perform).with('id', 'other_id') + expect(job_instance).to receive(:perform).with(no_args) expect(metrics_tracker).to receive(:track).with(job_record) perform @@ -120,7 +121,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the migration job raises an error' do shared_examples 'an error is raised' do |error_class| it 'marks the tracking record as failed' do - expect(job_instance).to receive(:perform).with('id', 'other_id').and_raise(error_class) + expect(job_instance).to receive(:perform).with(no_args).and_raise(error_class) freeze_time do expect { perform }.to raise_error(error_class) @@ -133,7 +134,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' end it 'tracks metrics of the execution' do - expect(job_instance).to receive(:perform).with('id', 'other_id').and_raise(error_class) + expect(job_instance).to receive(:perform).with(no_args).and_raise(error_class) expect(metrics_tracker).to receive(:track).with(job_record) expect { perform }.to raise_error(error_class) @@ -147,6 +148,7 @@ RSpec.describe Gitlab::Database::BackgroundMigration::BatchedMigrationWrapper, ' context 'when the batched background migration does not inherit from BatchedMigrationJob' do let(:job_class) { Class.new } + let(:job_instance) { job_class.new } it 'runs the job with the correct arguments' do expect(job_class).to receive(:new).with(no_args).and_return(job_instance) |