Update storage location after a project has been renamed

This commit is contained in:
Douglas Barbosa Alexandre 2018-12-18 17:00:27 -02:00
parent a0222cf81f
commit 3962c72519
No known key found for this signature in database
GPG Key ID: F1E98EF6393565A0
2 changed files with 21 additions and 0 deletions

View File

@ -81,6 +81,7 @@ module Projects
def update_repository_configuration
project.reload_repository!
project.write_repository_config
project.track_project_repository
end
def rename_transferred_documents

View File

@ -99,6 +99,17 @@ describe Projects::AfterRenameService do
expect(rugged_config['gitlab.fullpath']).to eq(project.full_path)
end
it 'updates storage location' do
allow(project_storage).to receive(:rename_repo).and_return(true)
described_class.new(project).execute
expect(project.project_repository).to have_attributes(
disk_path: project.disk_path,
shard_name: project.repository_storage
)
end
end
context 'using hashed storage' do
@ -193,6 +204,15 @@ describe Projects::AfterRenameService do
expect(rugged_config['gitlab.fullpath']).to eq(project.full_path)
end
it 'updates storage location' do
described_class.new(project).execute
expect(project.project_repository).to have_attributes(
disk_path: project.disk_path,
shard_name: project.repository_storage
)
end
end
end
end