diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2019-03-05 03:59:17 +0100 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2019-03-05 04:00:53 +0100 |
commit | b4f205020797319f06c52f769f385876e6427309 (patch) | |
tree | 0341e9ce0243e2902779dbcd4b3c78e0712f6c27 /spec/services/projects/hashed_storage/rollback_repository_service_spec.rb | |
parent | 7b4130d0f7390629d683e4365279ab5554bbcfc4 (diff) | |
download | gitlab-ce-b4f205020797319f06c52f769f385876e6427309.tar.gz |
Skip project validation when switching storage layouts
This is a fix for the Hashed Storage migration and Rollback procedure
to ignore any project-level validation error that can happen in a
long-running instance.
There are many situations where defaults and acceptable values changed
but, because we didn't provide a migration to "valid" attributes, it
can happen that project will not be `valid? => true`.
Because the changes we are making are limited to setting a project as
read_only or changing the storage_level, it's safe to bypass validation.
Diffstat (limited to 'spec/services/projects/hashed_storage/rollback_repository_service_spec.rb')
-rw-r--r-- | spec/services/projects/hashed_storage/rollback_repository_service_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb b/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb index 41927934501..bd4354a7df3 100644 --- a/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb +++ b/spec/services/projects/hashed_storage/rollback_repository_service_spec.rb @@ -104,6 +104,12 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis end end + it 'works even when project validation fails' do + allow(project).to receive(:valid?) { false } + + expect { service.execute }.to change { project.legacy_storage? }.to(true) + end + def expect_move_repository(from_name, to_name) expect(gitlab_shell).to receive(:mv_repository).with(project.repository_storage, from_name, to_name).and_call_original end |