Commit 04afe188 authored by Luke Duncalfe's avatar Luke Duncalfe

Add a test for hashed repo rollback scenario

parent d89fde84
......@@ -132,6 +132,8 @@ module Projects
end
def rollback_folder_move
return if project.hashed_storage?(:repository)
move_repo_folder(@new_path, @old_path)
move_repo_folder("#{@new_path}.wiki", "#{@old_path}.wiki")
end
......
......@@ -299,14 +299,14 @@ describe Projects::TransferService do
end
context 'when hashed storage in use' do
let(:hashed_project) { create(:project, :repository, namespace: user.namespace) }
let!(:hashed_project) { create(:project, :repository, namespace: user.namespace) }
let!(:old_disk_path) { hashed_project.repository.disk_path }
before do
group.add_owner(user)
end
it 'does not move the disk path', :aggregate_failures do
old_disk_path = hashed_project.repository.disk_path
new_full_path = "#{group.full_path}/#{hashed_project.path}"
transfer_project(hashed_project, user, group)
......@@ -318,6 +318,23 @@ describe Projects::TransferService do
)
expect(hashed_project.disk_path).to eq(old_disk_path)
end
it 'does not move the disk path when the transfer fails', :aggregate_failures do
old_full_path = hashed_project.full_path
expect_next_instance_of(described_class) do |service|
allow(service).to receive(:execute_system_hooks).and_raise('foo')
end
expect { transfer_project(hashed_project, user, group) }.to raise_error('foo')
hashed_project.reload_repository!
expect(hashed_project.repository).to have_attributes(
disk_path: old_disk_path,
full_path: old_full_path
)
expect(hashed_project.disk_path).to eq(old_disk_path)
end
end
describe 'refreshing project authorizations' 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