diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-13 22:27:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-13 22:27:03 +0300 |
commit | 7f5f940041c8d1ee074be96cc64bdccdd95649b1 (patch) | |
tree | 334342b5d7c1898efcbe345c51838b63aa5106bc /spec/services/projects/hashed_storage/migrate_repository_service_spec.rb | |
parent | b16db1458f5e0f6b0427cf3e2471302657297427 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.4
Diffstat (limited to 'spec/services/projects/hashed_storage/migrate_repository_service_spec.rb')
-rw-r--r-- | spec/services/projects/hashed_storage/migrate_repository_service_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
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 e03e75653ff..f0fd243f0ca 100644 --- a/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb +++ b/spec/services/projects/hashed_storage/migrate_repository_service_spec.rb @@ -77,6 +77,42 @@ RSpec.describe Projects::HashedStorage::MigrateRepositoryService do end end + context 'when exception happens' do + it 'handles OpenSSL::Cipher::CipherError' do + expect(project).to receive(:ensure_runners_token).and_raise(OpenSSL::Cipher::CipherError) + + expect { service.execute }.not_to raise_exception + end + + it 'ensures rollback when OpenSSL::Cipher::CipherError' do + expect(project).to receive(:ensure_runners_token).and_raise(OpenSSL::Cipher::CipherError) + expect(service).to receive(:rollback_folder_move).and_call_original + + service.execute + project.reload + + expect(project.legacy_storage?).to be_truthy + expect(project.repository_read_only?).to be_falsey + end + + it 'handles Gitlab::Git::CommandError' do + expect(project).to receive(:write_repository_config).and_raise(Gitlab::Git::CommandError) + + expect { service.execute }.not_to raise_exception + end + + it 'ensures rollback when Gitlab::Git::CommandError' do + expect(project).to receive(:write_repository_config).and_raise(Gitlab::Git::CommandError) + expect(service).to receive(:rollback_folder_move).and_call_original + + service.execute + project.reload + + expect(project.legacy_storage?).to be_truthy + expect(project.repository_read_only?).to be_falsey + end + end + context 'when one move fails' do it 'rollsback repositories to original name' do allow(service).to receive(:move_repository).and_call_original |