diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-18 10:31:22 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-18 10:36:12 +0200 |
commit | 5c3fd67075782b0cf1ef81254e81ae21b38a2012 (patch) | |
tree | 642b2d703eea66c0322ba7c88cf86e629a80130b /spec | |
parent | fa3acb3bb662bef9d16a072f78d0048365a0f1dc (diff) | |
download | gitlab-ce-5c3fd67075782b0cf1ef81254e81ae21b38a2012.tar.gz |
Add specs for stage_id reference cleanup migration
Diffstat (limited to 'spec')
-rw-r--r-- | spec/migrations/clean_stage_id_reference_migration_spec.rb | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/spec/migrations/clean_stage_id_reference_migration_spec.rb b/spec/migrations/clean_stage_id_reference_migration_spec.rb index 17be549ddd3..0518c4de799 100644 --- a/spec/migrations/clean_stage_id_reference_migration_spec.rb +++ b/spec/migrations/clean_stage_id_reference_migration_spec.rb @@ -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 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]) - context 'when there are scheduled background migrations' do - pending 'immediately processes scheduled jobs' do - fail + 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 |