Commit 5c3fd670 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs for stage_id reference cleanup migration

parent fa3acb3b
require 'spec_helper' require 'spec_helper'
require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb') require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb')
describe CleanStageIdReferenceMigration, :migration, :sidekiq do describe CleanStageIdReferenceMigration, :migration, :sidekiq, :redis do
context 'when there are enqueued background migrations' do let(:migration) { MigrateStageIdReferenceInBackground::MIGRATION }
pending 'processes enqueued jobs synchronously' do
fail context 'when there are pending background migrations' do
end it 'processes enqueued jobs synchronously' do
end Sidekiq::Testing.disable! do
BackgroundMigrationWorker.perform_in(2.minutes, migration, [1])
BackgroundMigrationWorker.perform_async(migration, [1])
expect(Gitlab::BackgroundMigration).to receive(:perform).twice
context 'when there are scheduled background migrations' do migrate!
pending 'immediately processes scheduled jobs' do end
fail
end end
end end
context 'when there are no background migrations pending' do context 'when there are no background migrations pending' do
pending 'does nothing' do it 'does nothing' do
fail Sidekiq::Testing.disable! do
expect(Gitlab::BackgroundMigration).not_to receive(:perform)
migrate!
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment