Move GeoHashedStorageMigrationWorker under Geo namespace

parent 8c79d5ee
......@@ -9,7 +9,7 @@ module Geo
end
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
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
expect { daemon.run_once! }.not_to change(Geo::ProjectRegistry, :count)
end
it 'schedules a GeoHashedStorageMigrationWorker' do
project_id = hashed_storage_migrated_event.project_id
it 'schedules a Geo::HashedStorageMigrationWorker' do
project = hashed_storage_migrated_event.project
old_disk_path = hashed_storage_migrated_event.old_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)
.with(project_id, old_disk_path, new_disk_path)
expect(::Geo::HashedStorageMigrationWorker).to receive(:perform_async)
.with(project.id, old_disk_path, new_disk_path, old_storage_version, new_storage_version)
daemon.run_once!
end
......
......@@ -27,13 +27,13 @@ describe Geo::HashedStorageMigrationService do
subject(:service) { described_class.new(project.id, project.full_path, new_path) }
it 'starts the worker' do
expect(GeoHashedStorageMigrationWorker).to receive(:perform_async)
expect(Geo::HashedStorageMigrationWorker).to receive(:perform_async)
service.async_execute
end
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')
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