diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-10-27 21:27:17 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-10-27 21:27:17 +0200 |
commit | b19076948de9d637ab5a74ea59249cdb680c8495 (patch) | |
tree | 47b7b321c1075d72ebd18e67c25f23eb36b31e89 /spec | |
parent | dfd6c3f824ada5558546b809fd32468325788b94 (diff) | |
download | gitlab-ce-b19076948de9d637ab5a74ea59249cdb680c8495.tar.gz |
Moved renaming operations to storage layer abstraction
When project storage_version is `2` means attachments are using
hashed storage.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_spec.rb | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 74eba7e33f6..d80af378140 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2452,6 +2452,7 @@ describe Project do context 'legacy storage' do let(:project) { create(:project, :repository) } let(:gitlab_shell) { Gitlab::Shell.new } + let(:project_storage) { project.send(:storage) } before do allow(project).to receive(:gitlab_shell).and_return(gitlab_shell) @@ -2546,6 +2547,30 @@ describe Project do it { expect { subject }.to raise_error(StandardError) } end + + context 'gitlab pages' do + before do + expect(project_storage).to receive(:rename_repo) { true } + end + + it 'moves pages folder to new location' do + expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project) + + project.rename_repo + end + end + + context 'attachments' do + before do + expect(project_storage).to receive(:rename_repo) { true } + end + + it 'moves uploads folder to new location' do + expect_any_instance_of(Gitlab::UploadsTransfer).to receive(:rename_project) + + project.rename_repo + end + end end describe '#pages_path' do @@ -2649,10 +2674,6 @@ describe Project do .to receive(:execute_hooks_for) .with(project, :rename) - expect_any_instance_of(Gitlab::UploadsTransfer) - .to receive(:rename_project) - .with('foo', project.path, project.namespace.full_path) - expect(project).to receive(:expire_caches_before_rename) expect(project).to receive(:expires_full_path_cache) @@ -2673,6 +2694,32 @@ describe Project do it { expect { subject }.to raise_error(StandardError) } end + + context 'gitlab pages' do + it 'moves pages folder to new location' do + expect_any_instance_of(Gitlab::PagesTransfer).to receive(:rename_project) + + project.rename_repo + end + end + + context 'attachments' do + it 'keeps uploads folder location unchanged' do + expect_any_instance_of(Gitlab::UploadsTransfer).not_to receive(:rename_project) + + project.rename_repo + end + + context 'when not rolled out' do + let(:project) { create(:project, :repository, storage_version: 1) } + + it 'moves pages folder to new location' do + expect_any_instance_of(Gitlab::UploadsTransfer).to receive(:rename_project) + + project.rename_repo + end + end + end end describe '#pages_path' do |