diff options
Diffstat (limited to 'spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb')
-rw-r--r-- | spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb b/spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb index 8fdd59d1d8c..cf488a4d753 100644 --- a/spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb +++ b/spec/support/shared_examples/workers/batched_background_migration_execution_worker_shared_example.rb @@ -3,6 +3,10 @@ RSpec.shared_examples 'batched background migrations execution worker' do include ExclusiveLeaseHelpers + before do + stub_feature_flags(disallow_database_ddl_feature_flags: false) + end + it 'is a limited capacity worker' do expect(described_class.new).to be_a(LimitedCapacity::Worker) end @@ -100,6 +104,23 @@ RSpec.shared_examples 'batched background migrations execution worker' do end end + context 'when disable ddl flag is enabled' do + let(:migration) do + create(:batched_background_migration, :active, interval: job_interval, table_name: table_name) + end + + before do + stub_feature_flags(disallow_database_ddl_feature_flags: true) + end + + it 'does nothing' do + expect(Gitlab::Database::BackgroundMigration::BatchedMigration).not_to receive(:find_executable) + expect(worker).not_to receive(:run_migration_job) + + worker.perform_work(database_name, migration.id) + end + end + context 'when the feature flag is enabled' do before do stub_feature_flags(execute_batched_migrations_on_schedule: true) |