Add specs for stage_id reference cleanup migration

This commit is contained in:
Grzegorz Bizon 2017-07-18 10:31:22 +02:00
parent fa3acb3bb6
commit 5c3fd67075
1 changed files with 18 additions and 11 deletions

View File

@ -1,22 +1,29 @@
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20170710083355_clean_stage_id_reference_migration.rb')
describe CleanStageIdReferenceMigration, :migration, :sidekiq do
context 'when there are enqueued background migrations' do
pending 'processes enqueued jobs synchronously' do
fail
end
end
describe CleanStageIdReferenceMigration, :migration, :sidekiq, :redis do
let(:migration) { MigrateStageIdReferenceInBackground::MIGRATION }
context 'when there are scheduled background migrations' do
pending 'immediately processes scheduled jobs' do
fail
context 'when there are pending background migrations' do
it 'processes enqueued jobs synchronously' do
Sidekiq::Testing.disable! do
BackgroundMigrationWorker.perform_in(2.minutes, migration, [1])
BackgroundMigrationWorker.perform_async(migration, [1])
expect(Gitlab::BackgroundMigration).to receive(:perform).twice
migrate!
end
end
end
context 'when there are no background migrations pending' do
pending 'does nothing' do
fail
it 'does nothing' do
Sidekiq::Testing.disable! do
expect(Gitlab::BackgroundMigration).not_to receive(:perform)
migrate!
end
end
end
end