Commit d5c8f3e1 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'remove_kwargs_from_storage_move_worker' into 'master'

Remove kwargs from storage move worker

Closes #217175

See merge request gitlab-org/gitlab!31412
parents d0ee45f4 fa0860e5
...@@ -39,8 +39,9 @@ class ProjectRepositoryStorageMove < ApplicationRecord ...@@ -39,8 +39,9 @@ class ProjectRepositoryStorageMove < ApplicationRecord
after_transition initial: :scheduled do |storage_move, _| after_transition initial: :scheduled do |storage_move, _|
storage_move.run_after_commit do storage_move.run_after_commit do
ProjectUpdateRepositoryStorageWorker.perform_async( ProjectUpdateRepositoryStorageWorker.perform_async(
storage_move.project_id, storage_move.destination_storage_name, storage_move.project_id,
repository_storage_move_id: storage_move.id storage_move.destination_storage_name,
storage_move.id
) )
end end
end end
......
...@@ -5,7 +5,7 @@ class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/Idempot ...@@ -5,7 +5,7 @@ class ProjectUpdateRepositoryStorageWorker # rubocop:disable Scalability/Idempot
feature_category :gitaly feature_category :gitaly
def perform(project_id, new_repository_storage_key, repository_storage_move_id: nil) def perform(project_id, new_repository_storage_key, repository_storage_move_id = nil)
repository_storage_move = repository_storage_move =
if repository_storage_move_id if repository_storage_move_id
ProjectRepositoryStorageMove.find(repository_storage_move_id) ProjectRepositoryStorageMove.find(repository_storage_move_id)
......
---
title: Remove kwargs from storage move worker
merge_request: 31412
author:
type: fixed
...@@ -46,7 +46,7 @@ RSpec.describe ProjectRepositoryStorageMove, type: :model do ...@@ -46,7 +46,7 @@ RSpec.describe ProjectRepositoryStorageMove, type: :model do
context 'and transits to scheduled' do context 'and transits to scheduled' do
it 'triggers ProjectUpdateRepositoryStorageWorker' do it 'triggers ProjectUpdateRepositoryStorageWorker' do
expect(ProjectUpdateRepositoryStorageWorker).to receive(:perform_async).with(project.id, 'test_second_storage', repository_storage_move_id: storage_move.id) expect(ProjectUpdateRepositoryStorageWorker).to receive(:perform_async).with(project.id, 'test_second_storage', storage_move.id)
storage_move.schedule! storage_move.schedule!
end end
......
...@@ -2844,7 +2844,7 @@ describe Project do ...@@ -2844,7 +2844,7 @@ describe Project do
end end
it 'schedules the transfer of the repository to the new storage and locks the project' do it 'schedules the transfer of the repository to the new storage and locks the project' do
expect(ProjectUpdateRepositoryStorageWorker).to receive(:perform_async).with(project.id, 'test_second_storage', repository_storage_move_id: anything) expect(ProjectUpdateRepositoryStorageWorker).to receive(:perform_async).with(project.id, 'test_second_storage', anything)
project.change_repository_storage('test_second_storage') project.change_repository_storage('test_second_storage')
project.save! project.save!
......
...@@ -40,7 +40,7 @@ describe ProjectUpdateRepositoryStorageWorker do ...@@ -40,7 +40,7 @@ describe ProjectUpdateRepositoryStorageWorker do
expect(service).to receive(:execute) expect(service).to receive(:execute)
expect do expect do
subject.perform(nil, nil, repository_storage_move_id: repository_storage_move.id) subject.perform(nil, nil, repository_storage_move.id)
end.not_to change(ProjectRepositoryStorageMove, :count) end.not_to change(ProjectRepositoryStorageMove, :count)
end end
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