diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-07 17:38:40 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-07 17:38:40 +0000 |
commit | f469bb8e5c3e7114e35862822087a1479d042a12 (patch) | |
tree | 46925003a1aa7c7cea72859ea04520f10d7a9177 /spec | |
parent | a1a8202f081f75431dee14e246cd55acaddba2aa (diff) | |
parent | b4f205020797319f06c52f769f385876e6427309 (diff) | |
download | gitlab-ce-f469bb8e5c3e7114e35862822087a1479d042a12.tar.gz |
Merge branch '56618-hashed-storage-skip-validation' into 'master'
Resolve "Hashed storage migration should not be attempted if project does not validate"
Closes #56618
See merge request gitlab-org/gitlab-ce!25753
Diffstat (limited to 'spec')
4 files changed, 24 insertions, 0 deletions
diff --git a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb index 639dd930618..efe15139717 100644 --- a/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb +++ b/spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb @@ -76,6 +76,12 @@ describe Projects::HashedStorage::MigrateAttachmentsService do expect { service.execute }.to raise_error(Projects::HashedStorage::AttachmentCannotMoveError) end end + + it 'works even when project validation fails' do + allow(project).to receive(:valid?) { false } + + expect { service.execute }.to change { project.hashed_storage?(:attachments) }.to(true) + end end context '#old_disk_path' do diff --git a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb index e77e2198439..42b0d256cbf 100644 --- a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb +++ b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb @@ -102,6 +102,12 @@ describe Projects::HashedStorage::MigrateRepositoryService do end end + it 'works even when project validation fails' do + allow(project).to receive(:valid?) { false } + + expect { service.execute }.to change { project.hashed_storage?(:repository) }.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 diff --git a/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb b/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb index 6f4154d6011..815c85e0866 100644 --- a/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb +++ b/spec/services/projects/hashed_storage/rollback_attachments_service_spec.rb @@ -78,6 +78,12 @@ describe Projects::HashedStorage::RollbackAttachmentsService do expect { service.execute }.to raise_error(Projects::HashedStorage::AttachmentCannotMoveError) end end + + it 'works even when project validation fails' do + allow(project).to receive(:valid?) { false } + + expect { service.execute }.to change { project.hashed_storage?(:attachments) }.to(false) + end end context '#old_disk_path' do 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 |