diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-13 11:44:52 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-13 11:44:52 +0200 |
commit | 2a0ead2c4730110c898127660fe6600155539f0c (patch) | |
tree | 35d9ac1ab2f78a227e6bfeb542c309711bb3d558 /spec | |
parent | 388abbd10c043b4cc406fa717e05dd81b0858c02 (diff) | |
download | gitlab-ce-2a0ead2c4730110c898127660fe6600155539f0c.tar.gz |
Implement draining scheduled sets of background migrations
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/background_migration_spec.rb | 14 | ||||
-rw-r--r-- | spec/support/sidekiq.rb | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 93ffaab65ce..d823c5342ae 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -34,6 +34,20 @@ describe Gitlab::BackgroundMigration do described_class.steal('Bar') end end + + context 'when there are scheduled jobs present', :sidekiq, :redis do + it 'steals all jobs from the schedule 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) + + described_class.steal('Object') + + expect(Sidekiq::ScheduledSet.new).to be_none + end + end + end end describe '.perform' do diff --git a/spec/support/sidekiq.rb b/spec/support/sidekiq.rb index 5478fea4e64..d143014692d 100644 --- a/spec/support/sidekiq.rb +++ b/spec/support/sidekiq.rb @@ -8,4 +8,8 @@ RSpec.configure do |config| config.after(:each, :sidekiq) do Sidekiq::Worker.clear_all end + + config.after(:each, :sidekiq, :redis) do + Sidekiq.redis { |redis| redis.flushdb } + end end |