diff options
author | Stan Hu <stanhu@gmail.com> | 2019-01-19 01:53:52 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-01-19 02:54:24 +0300 |
commit | 100b050b996072cc302a3a7f8fac850ddaab27d4 (patch) | |
tree | da5eb0b03402cbea10fb4af60945d4943680753a /spec/lib/gitlab/bitbucket_server_import | |
parent | 49efb57914b7daac651e0b3fbeb850584be66ce7 (diff) |
Fix import handling errors in Bitbucket Server importer
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20724 removed
`Gitlab::Git::RepositoryMirroring::RemoteError`, but this was still
being handled in the Bitbucket Server importer and only encountered if
some exception other than `Gitlab::Shell::Error` were thrown.
Diffstat (limited to 'spec/lib/gitlab/bitbucket_server_import')
-rw-r--r-- | spec/lib/gitlab/bitbucket_server_import/importer_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb index 70423823b89..1e90a2ef27f 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb @@ -21,12 +21,9 @@ describe Gitlab::BitbucketServerImport::Importer do end describe '#import_repository' do - before do + it 'adds a remote' do expect(subject).to receive(:import_pull_requests) expect(subject).to receive(:delete_temp_branches) - end - - it 'adds a remote' do expect(project.repository).to receive(:fetch_as_mirror) .with('http://bitbucket:test@my-bitbucket', refmap: [:heads, :tags, '+refs/pull-requests/*/to:refs/merge-requests/*/head'], @@ -34,6 +31,18 @@ describe Gitlab::BitbucketServerImport::Importer do subject.execute end + + it 'raises a Gitlab::Shell exception in the fetch' do + expect(project.repository).to receive(:fetch_as_mirror).and_raise(Gitlab::Shell::Error) + + expect { subject.execute }.to raise_error(Gitlab::Shell::Error) + end + + it 'raises an unhandled exception in the fetch' do + expect(project.repository).to receive(:fetch_as_mirror).and_raise(RuntimeError) + + expect { subject.execute }.to raise_error(RuntimeError) + end end describe '#import_pull_requests' do |