diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-03-18 14:46:44 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-03-18 14:46:44 +0000 |
commit | c94160b9e9e52455a00ad0ab9911bffc0a832d90 (patch) | |
tree | 3f9f6b7349ca4bf942bc50f5ffc695fa88b474b7 | |
parent | 142c39aee6e0e3fb8e73d6eb818e49ef7795cfc4 (diff) | |
parent | 523712d116a560f314cf144edbde076d7ab6fdc4 (diff) | |
download | gitlab-ce-c94160b9e9e52455a00ad0ab9911bffc0a832d90.tar.gz |
Merge branch '58739-fix-storage-migration' into 'master'
Fix storage migration check for non-empty queues
Closes #58739
See merge request gitlab-org/gitlab-ce!26109
-rw-r--r-- | lib/gitlab/hashed_storage/migrator.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/hashed_storage/migrator_spec.rb | 10 | ||||
-rw-r--r-- | spec/tasks/gitlab/storage_rake_spec.rb | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb index f5368d41629..1f0deebea39 100644 --- a/lib/gitlab/hashed_storage/migrator.rb +++ b/lib/gitlab/hashed_storage/migrator.rb @@ -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 diff --git a/spec/lib/gitlab/hashed_storage/migrator_spec.rb b/spec/lib/gitlab/hashed_storage/migrator_spec.rb index d03a74ac9eb..8e253b51597 100644 --- a/spec/lib/gitlab/hashed_storage/migrator_spec.rb +++ b/spec/lib/gitlab/hashed_storage/migrator_spec.rb @@ -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 diff --git a/spec/tasks/gitlab/storage_rake_spec.rb b/spec/tasks/gitlab/storage_rake_spec.rb index 736809eee5b..4b04d9cec39 100644 --- a/spec/tasks/gitlab/storage_rake_spec.rb +++ b/spec/tasks/gitlab/storage_rake_spec.rb @@ -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) |