Fix storage migration check for non-empty queues
The previous code works fine when running specs, but the API does not exist outside that environment.
This commit is contained in:
parent
7d985db140
commit
523712d116
3 changed files with 10 additions and 10 deletions
|
@ -97,7 +97,7 @@ module Gitlab
|
|||
|
||||
def any_non_empty_queue?(*workers)
|
||||
workers.any? do |worker|
|
||||
worker.jobs.any?
|
||||
!Sidekiq::Queue.new(worker.queue).size.zero?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gitlab::HashedStorage::Migrator, :sidekiq do
|
||||
describe Gitlab::HashedStorage::Migrator, :sidekiq, :redis do
|
||||
describe '#bulk_schedule_migration' do
|
||||
it 'schedules job to HashedStorage::MigratorWorker' do
|
||||
Sidekiq::Testing.fake! do
|
||||
|
@ -189,7 +189,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq do
|
|||
set(:project) { create(:project, :empty_repo) }
|
||||
|
||||
it 'returns true when there are MigratorWorker jobs scheduled' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::MigratorWorker.perform_async(1, 5)
|
||||
|
||||
expect(subject.migration_pending?).to be_truthy
|
||||
|
@ -197,7 +197,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq do
|
|||
end
|
||||
|
||||
it 'returns true when there are ProjectMigrateWorker jobs scheduled' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::ProjectMigrateWorker.perform_async(1)
|
||||
|
||||
expect(subject.migration_pending?).to be_truthy
|
||||
|
@ -213,7 +213,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq do
|
|||
set(:project) { create(:project, :empty_repo) }
|
||||
|
||||
it 'returns true when there are RollbackerWorker jobs scheduled' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::RollbackerWorker.perform_async(1, 5)
|
||||
|
||||
expect(subject.rollback_pending?).to be_truthy
|
||||
|
@ -221,7 +221,7 @@ describe Gitlab::HashedStorage::Migrator, :sidekiq do
|
|||
end
|
||||
|
||||
it 'returns true when there are jobs scheduled' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::ProjectRollbackWorker.perform_async(1)
|
||||
|
||||
expect(subject.rollback_pending?).to be_truthy
|
||||
|
|
|
@ -89,9 +89,9 @@ describe 'rake gitlab:storage:*', :sidekiq do
|
|||
describe 'gitlab:storage:migrate_to_hashed' do
|
||||
let(:task) { 'gitlab:storage:migrate_to_hashed' }
|
||||
|
||||
context 'with rollback already scheduled' do
|
||||
context 'with rollback already scheduled', :redis do
|
||||
it 'does nothing' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::RollbackerWorker.perform_async(1, 5)
|
||||
|
||||
expect(Project).not_to receive(:with_unmigrated_storage)
|
||||
|
@ -146,9 +146,9 @@ describe 'rake gitlab:storage:*', :sidekiq do
|
|||
|
||||
it_behaves_like 'make sure database is writable'
|
||||
|
||||
context 'with migration already scheduled' do
|
||||
context 'with migration already scheduled', :redis do
|
||||
it 'does nothing' do
|
||||
Sidekiq::Testing.fake! do
|
||||
Sidekiq::Testing.disable! do
|
||||
::HashedStorage::MigratorWorker.perform_async(1, 5)
|
||||
|
||||
expect(Project).not_to receive(:with_unmigrated_storage)
|
||||
|
|
Loading…
Reference in a new issue