Move GeoHashedStorageMigrationWorker under Geo namespace

parent 8c79d5ee
...@@ -9,7 +9,7 @@ module Geo ...@@ -9,7 +9,7 @@ module Geo
end end
def async_execute def async_execute
GeoHashedStorageMigrationWorker.perform_async(project_id, old_disk_path, new_disk_path) Geo::HashedStorageMigrationWorker.perform_async(project_id, old_disk_path, new_disk_path)
end end
def execute def execute
......
module Geo
class HashedStorageMigrationWorker
include Sidekiq::Worker
include GeoQueue
def perform(project_id, old_disk_path, new_disk_path)
Geo::HashedStorageMigrationService.new(project_id, old_disk_path, new_disk_path).execute
end
end
end
class GeoHashedStorageMigrationWorker
include Sidekiq::Worker
include GeoQueue
def perform(project_id, old_disk_path, new_disk_path)
Geo::HashedStorageMigrationService.new(project_id, old_disk_path, new_disk_path).execute
end
end
...@@ -225,13 +225,15 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql do ...@@ -225,13 +225,15 @@ describe Gitlab::Geo::LogCursor::Daemon, :postgresql do
expect { daemon.run_once! }.not_to change(Geo::ProjectRegistry, :count) expect { daemon.run_once! }.not_to change(Geo::ProjectRegistry, :count)
end end
it 'schedules a GeoHashedStorageMigrationWorker' do it 'schedules a Geo::HashedStorageMigrationWorker' do
project_id = hashed_storage_migrated_event.project_id project = hashed_storage_migrated_event.project
old_disk_path = hashed_storage_migrated_event.old_disk_path old_disk_path = hashed_storage_migrated_event.old_disk_path
new_disk_path = hashed_storage_migrated_event.new_disk_path new_disk_path = hashed_storage_migrated_event.new_disk_path
old_storage_version = project.storage_version
new_storage_version = hashed_storage_migrated_event.new_storage_version
expect(::GeoHashedStorageMigrationWorker).to receive(:perform_async) expect(::Geo::HashedStorageMigrationWorker).to receive(:perform_async)
.with(project_id, old_disk_path, new_disk_path) .with(project.id, old_disk_path, new_disk_path, old_storage_version, new_storage_version)
daemon.run_once! daemon.run_once!
end end
......
...@@ -27,13 +27,13 @@ describe Geo::HashedStorageMigrationService do ...@@ -27,13 +27,13 @@ describe Geo::HashedStorageMigrationService do
subject(:service) { described_class.new(project.id, project.full_path, new_path) } subject(:service) { described_class.new(project.id, project.full_path, new_path) }
it 'starts the worker' do it 'starts the worker' do
expect(GeoHashedStorageMigrationWorker).to receive(:perform_async) expect(Geo::HashedStorageMigrationWorker).to receive(:perform_async)
service.async_execute service.async_execute
end end
it 'returns job id' do it 'returns job id' do
allow(GeoHashedStorageMigrationWorker).to receive(:perform_async).and_return('foo') allow(Geo::HashedStorageMigrationWorker).to receive(:perform_async).and_return('foo')
expect(service.async_execute).to eq('foo') expect(service.async_execute).to eq('foo')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment