diff options
author | Mark Chao <mchao@gitlab.com> | 2019-01-30 12:03:23 +0300 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2019-02-02 16:45:10 +0300 |
commit | c34f6ea604338820710bd2bff86620b3bf2dce22 (patch) | |
tree | b7482c7c57bb9657681057a085f43fde913990ae /spec/lib/gitlab/background_migration_spec.rb | |
parent | dd26a9addc5dd654e3c8eecb58216f1f4449cfc1 (diff) |
Consume remaining MigrateApproverToApprovalRulesInBatch
Allow `steal` to handle dead jobs.
Diffstat (limited to 'spec/lib/gitlab/background_migration_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 8a83b76fd94..7d3d8a949ef 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -104,6 +104,38 @@ describe Gitlab::BackgroundMigration do end end end + + context 'when retry_dead_jobs is true', :sidekiq, :redis do + let(:retry_queue) do + [double(args: ['Object', [3]], queue: described_class.queue, delete: true)] + end + let(:dead_queue) do + [double(args: ['Object', [4]], queue: described_class.queue, delete: true)] + end + + before do + allow(Sidekiq::RetrySet).to receive(:new).and_return(retry_queue) + allow(Sidekiq::DeadSet).to receive(:new).and_return(dead_queue) + end + + it 'steals from the dead and retry queue' do + Sidekiq::Testing.disable! do + expect(described_class).to receive(:perform) + .with('Object', [1]).ordered + expect(described_class).to receive(:perform) + .with('Object', [2]).ordered + expect(described_class).to receive(:perform) + .with('Object', [3]).ordered + expect(described_class).to receive(:perform) + .with('Object', [4]).ordered + + BackgroundMigrationWorker.perform_async('Object', [2]) + BackgroundMigrationWorker.perform_in(10.minutes, 'Object', [1]) + + described_class.steal('Object', retry_dead_jobs: true) + end + end + end end describe '.perform' do |