diff options
Diffstat (limited to 'spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb index 54962eac100..1da21633504 100644 --- a/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb +++ b/spec/support/shared_examples/workers/batched_background_migration_worker_shared_examples.rb @@ -229,6 +229,7 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d describe 'executing an entire migration', :freeze_time, if: Gitlab::Database.has_config?(tracking_database) do include Gitlab::Database::DynamicModelHelpers + include Database::DatabaseHelpers let(:migration_class) do Class.new(Gitlab::BackgroundMigration::BatchedMigrationJob) do @@ -347,5 +348,20 @@ RSpec.shared_examples 'it runs batched background migration jobs' do |tracking_d it 'does not update non-matching records in the range' do expect { full_migration_run }.not_to change { example_data.where('status <> 1 AND some_column <> 0').count } end + + context 'health status' do + subject(:migration_run) { described_class.new.perform } + + it 'puts migration on hold when there is autovaccum activity on related tables' do + swapout_view_for_table(:postgres_autovacuum_activity, connection: connection) + create( + :postgres_autovacuum_activity, + table: migration.table_name, + table_identifier: "public.#{migration.table_name}" + ) + + expect { migration_run }.to change { migration.reload.on_hold? }.from(false).to(true) + end + end end end |