diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-21 18:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-21 18:08:36 +0300 |
commit | 81884c35b86035f89364db482e4fff91718bb63a (patch) | |
tree | 49090a57dd0e6e49390f593bf24ee49dd8fb7b7f /spec/workers/bulk_import_worker_spec.rb | |
parent | 6f3692902c2e5dc690593b8c44f77b86b5c28904 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/bulk_import_worker_spec.rb')
-rw-r--r-- | spec/workers/bulk_import_worker_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/workers/bulk_import_worker_spec.rb b/spec/workers/bulk_import_worker_spec.rb index d3a4144d606..8cf14ed6f8b 100644 --- a/spec/workers/bulk_import_worker_spec.rb +++ b/spec/workers/bulk_import_worker_spec.rb @@ -72,6 +72,21 @@ RSpec.describe BulkImportWorker do expect(bulk_import.entities.map(&:status_name)).to contain_exactly(:created, :started) end end + + context 'when exception occurs' do + it 'tracks the exception & marks import as failed' do + bulk_import = create(:bulk_import, :created) + create(:bulk_import_entity, :created, bulk_import: bulk_import) + + allow(BulkImports::EntityWorker).to receive(:perform_async).and_raise(StandardError) + + expect(Gitlab::ErrorTracking).to receive(:track_exception).with(kind_of(StandardError), bulk_import_id: bulk_import.id) + + subject.perform(bulk_import.id) + + expect(bulk_import.reload.failed?).to eq(true) + end + end end end end |