diff options
author | Nick Thomas <nick@gitlab.com> | 2018-08-25 07:44:51 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-08-25 07:44:51 +0300 |
commit | 26ea5437f17ce2a6546fbfd644b93b7f18896783 (patch) | |
tree | 7f1ddd0846d9515a7bb1714711be88d4b633f01e /spec/services/projects | |
parent | ee2aaa29dd483a237b91aa46e9000e085b912e1e (diff) | |
parent | 7b7969bf15894660411d8ea53f4fa5101c6571b4 (diff) |
Merge branch '50345-hashed-storage-feature-flag' into 'master'
Feature flag to disable Hashed Storage migration when renaming a repository
Closes #50345
See merge request gitlab-org/gitlab-ce!21291
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/update_service_spec.rb | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index 9572b4110d5..695b9980548 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -249,9 +249,20 @@ describe Projects::UpdateService do expect(project.errors.messages[:base]).to include('There is already a repository with that name on disk') end - context 'when hashed storage enabled' do + it 'renames the project without upgrading it' do + result = update_project(project, admin, path: 'new-path') + + expect(result).not_to include(status: :error) + expect(project).to be_valid + expect(project.errors).to be_empty + expect(project.disk_path).to include('new-path') + expect(project.reload.hashed_storage?(:repository)).to be_falsey + end + + context 'when hashed storage is enabled' do before do stub_application_setting(hashed_storage_enabled: true) + stub_feature_flags(skip_hashed_storage_upgrade: false) end it 'migrates project to a hashed storage instead of renaming the repo to another legacy name' do @@ -262,6 +273,22 @@ describe Projects::UpdateService do expect(project.errors).to be_empty expect(project.reload.hashed_storage?(:repository)).to be_truthy end + + context 'when skip_hashed_storage_upgrade feature flag is enabled' do + before do + stub_feature_flags(skip_hashed_storage_upgrade: true) + end + + it 'renames the project without upgrading it' do + result = update_project(project, admin, path: 'new-path') + + expect(result).not_to include(status: :error) + expect(project).to be_valid + expect(project.errors).to be_empty + expect(project.disk_path).to include('new-path') + expect(project.reload.hashed_storage?(:repository)).to be_falsey + end + end end end |