Add more specs for background migrations queue processing
This commit is contained in:
parent
2a0ead2c47
commit
433b6d2c65
1 changed files with 18 additions and 1 deletions
|
@ -36,9 +36,10 @@ describe Gitlab::BackgroundMigration do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when there are scheduled jobs present', :sidekiq, :redis do
|
context 'when there are scheduled jobs present', :sidekiq, :redis do
|
||||||
it 'steals all jobs from the schedule sets' do
|
it 'steals all jobs from the scheduled sets' do
|
||||||
Sidekiq::Testing.disable! do
|
Sidekiq::Testing.disable! do
|
||||||
BackgroundMigrationWorker.perform_in(10.minutes, 'Object')
|
BackgroundMigrationWorker.perform_in(10.minutes, 'Object')
|
||||||
|
|
||||||
expect(Sidekiq::ScheduledSet.new).to be_one
|
expect(Sidekiq::ScheduledSet.new).to be_one
|
||||||
expect(described_class).to receive(:perform).with('Object', any_args)
|
expect(described_class).to receive(:perform).with('Object', any_args)
|
||||||
|
|
||||||
|
@ -48,6 +49,22 @@ describe Gitlab::BackgroundMigration do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when there are enqueued and scheduled jobs present', :sidekiq, :redis do
|
||||||
|
it 'steals from the scheduled sets queue first' 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
|
||||||
|
|
||||||
|
BackgroundMigrationWorker.perform_async('Object', [2])
|
||||||
|
BackgroundMigrationWorker.perform_in(10.minutes, 'Object', [1])
|
||||||
|
|
||||||
|
described_class.steal('Object')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.perform' do
|
describe '.perform' do
|
||||||
|
|
Loading…
Reference in a new issue