summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-13 12:00:23 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-13 12:00:23 +0200
commit433b6d2c65f0018fa67e2d8905d1cba75e7990fa (patch)
tree9661010072c1f527b63dae0c316610335309378a
parent2a0ead2c4730110c898127660fe6600155539f0c (diff)
downloadgitlab-ce-433b6d2c65f0018fa67e2d8905d1cba75e7990fa.tar.gz
Add more specs for background migrations queue processing
-rw-r--r--spec/lib/gitlab/background_migration_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb
index d823c5342ae..55bf7040ef3 100644
--- a/spec/lib/gitlab/background_migration_spec.rb
+++ b/spec/lib/gitlab/background_migration_spec.rb
@@ -36,9 +36,10 @@ describe Gitlab::BackgroundMigration do
end
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
BackgroundMigrationWorker.perform_in(10.minutes, 'Object')
+
expect(Sidekiq::ScheduledSet.new).to be_one
expect(described_class).to receive(:perform).with('Object', any_args)
@@ -48,6 +49,22 @@ describe Gitlab::BackgroundMigration do
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
describe '.perform' do