diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 18:09:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 18:09:37 +0300 |
commit | 2c89e169769ead722394a79ed67fcd08e96863dd (patch) | |
tree | 0dadb576846c484475b895f75fab41f71cdb952e /spec/lib/gitlab/background_migration_spec.rb | |
parent | bd497e352ebd279536ae11855871162e82a3f88c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/background_migration_spec.rb')
-rw-r--r-- | spec/lib/gitlab/background_migration_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/background_migration_spec.rb b/spec/lib/gitlab/background_migration_spec.rb index 9546550bfc5..71959f54b38 100644 --- a/spec/lib/gitlab/background_migration_spec.rb +++ b/spec/lib/gitlab/background_migration_spec.rb @@ -165,6 +165,32 @@ describe Gitlab::BackgroundMigration do end end + describe '.remaining', :redis do + context 'when there are jobs remaining' do + let(:queue) { Array.new(12) } + + before do + allow(Sidekiq::Queue).to receive(:new) + .with(described_class.queue) + .and_return(Array.new(12)) + + Sidekiq::Testing.disable! do + BackgroundMigrationWorker.perform_in(10.minutes, 'Foo') + end + end + + it 'returns the enqueued jobs plus the scheduled jobs' do + expect(described_class.remaining).to eq(13) + end + end + + context 'when there are no jobs remaining' do + it 'returns zero' do + expect(described_class.remaining).to be_zero + end + end + end + describe '.exists?' do context 'when there are enqueued jobs present' do let(:queue) do |