Commit 23dd285a authored by James Fargher's avatar James Fargher

Ensure original repository is archived after a shard move

parent 5b81f9dc
......@@ -93,25 +93,25 @@ module Projects
old_repository_storage = project.repository_storage
new_project_path = moved_path(project.disk_path)
# Notice that the block passed to `run_after_commit` will run with `project`
# Notice that the block passed to `run_after_commit` will run with `repository_storage_move`
# as its context
project.run_after_commit do
repository_storage_move.run_after_commit do
GitlabShellWorker.perform_async(:mv_repository,
old_repository_storage,
disk_path,
project.disk_path,
new_project_path)
if wiki.repository_exists?
if project.wiki.repository_exists?
GitlabShellWorker.perform_async(:mv_repository,
old_repository_storage,
wiki.disk_path,
project.wiki.disk_path,
"#{new_project_path}.wiki")
end
if design_repository.exists?
if project.design_repository.exists?
GitlabShellWorker.perform_async(:mv_repository,
old_repository_storage,
design_repository.disk_path,
project.design_repository.disk_path,
"#{new_project_path}.design")
end
end
......
---
title: Ensure original repository is archived after a shard move
merge_request: 34895
author:
type: fixed
......@@ -43,6 +43,8 @@ describe Projects::UpdateRepositoryStorageService do
.with(project.repository.raw)
expect(project_repository_double).to receive(:checksum)
.and_return(checksum)
expect(GitlabShellWorker).to receive(:perform_async).with(:mv_repository, 'default', anything, anything)
.and_call_original
result = subject.execute
......
......@@ -38,6 +38,9 @@ RSpec.shared_examples 'moves repository to another storage' do |repository_type|
.with(repository.raw)
allow(repository_double).to receive(:checksum)
.and_return(repository_checksum)
expect(GitlabShellWorker).to receive(:perform_async).with(:mv_repository, 'default', anything, anything)
.twice.and_call_original
end
it "moves the project and its #{repository_type} repository to the new storage and unmarks the repository as read only" do
......
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