Update storage location after a project has been renamed

parent a0222cf8
...@@ -81,6 +81,7 @@ module Projects ...@@ -81,6 +81,7 @@ module Projects
def update_repository_configuration def update_repository_configuration
project.reload_repository! project.reload_repository!
project.write_repository_config project.write_repository_config
project.track_project_repository
end end
def rename_transferred_documents def rename_transferred_documents
......
...@@ -99,6 +99,17 @@ describe Projects::AfterRenameService do ...@@ -99,6 +99,17 @@ describe Projects::AfterRenameService do
expect(rugged_config['gitlab.fullpath']).to eq(project.full_path) expect(rugged_config['gitlab.fullpath']).to eq(project.full_path)
end 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 end
context 'using hashed storage' do context 'using hashed storage' do
...@@ -193,6 +204,15 @@ describe Projects::AfterRenameService do ...@@ -193,6 +204,15 @@ describe Projects::AfterRenameService do
expect(rugged_config['gitlab.fullpath']).to eq(project.full_path) expect(rugged_config['gitlab.fullpath']).to eq(project.full_path)
end 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 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