summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-11-17 14:23:47 +0000
committerNick Thomas <nick@gitlab.com>2017-11-17 14:23:47 +0000
commit76b2a7caa5219662a29f0eb16f0507aac1976f33 (patch)
tree4765aeb070c0f702eb76622278fffabad51782af /spec
parent5c0ba938aa55009d891da25abc66b0fb3bd7d43b (diff)
parent0c085aaf446a2cef0819a55a009c73a796cdf6e1 (diff)
downloadgitlab-ce-76b2a7caa5219662a29f0eb16f0507aac1976f33.tar.gz
Merge branch 'sh-port-hashed-storage-transfer-fix' into 'master'
Fix hashed storage with project transfers to another namespace Closes gitlab-ee#4056 See merge request gitlab-org/gitlab-ce!15444
Diffstat (limited to 'spec')
-rw-r--r--spec/services/projects/transfer_service_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb
index 2459f371a91..2b1337bee7e 100644
--- a/spec/services/projects/transfer_service_spec.rb
+++ b/spec/services/projects/transfer_service_spec.rb
@@ -42,6 +42,18 @@ describe Projects::TransferService do
expect(service).to receive(:execute_system_hooks)
end
end
+
+ it 'disk path has moved' do
+ old_path = project.repository.disk_path
+ old_full_path = project.repository.full_path
+
+ transfer_project(project, user, group)
+
+ expect(project.repository.disk_path).not_to eq(old_path)
+ expect(project.repository.full_path).not_to eq(old_full_path)
+ expect(project.disk_path).not_to eq(old_path)
+ expect(project.disk_path).to start_with(group.path)
+ end
end
context 'when transfer fails' do
@@ -188,6 +200,26 @@ describe Projects::TransferService do
end
end
+ context 'when hashed storage in use' do
+ let(:hashed_project) { create(:project, :repository, :hashed, namespace: user.namespace) }
+
+ before do
+ group.add_owner(user)
+ end
+
+ it 'does not move the directory' do
+ old_path = hashed_project.repository.disk_path
+ old_full_path = hashed_project.repository.full_path
+
+ transfer_project(hashed_project, user, group)
+ project.reload
+
+ expect(hashed_project.repository.disk_path).to eq(old_path)
+ expect(hashed_project.repository.full_path).to eq(old_full_path)
+ expect(hashed_project.disk_path).to eq(old_path)
+ end
+ end
+
describe 'refreshing project authorizations' do
let(:group) { create(:group) }
let(:owner) { project.namespace.owner }