diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-18 00:08:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-18 00:08:29 +0300 |
commit | 40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9 (patch) | |
tree | 9b735ef933178be36d35088f3acab2d9b75dbbad /spec/support/shared_examples/lib | |
parent | 22a0d312ae82e7dda3073d5d1a5a766d7641738d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/lib')
-rw-r--r-- | spec/support/shared_examples/lib/gitlab/import_export/import_failure_service_shared_examples.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/import_export/import_failure_service_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/import_export/import_failure_service_shared_examples.rb new file mode 100644 index 00000000000..691564120cc --- /dev/null +++ b/spec/support/shared_examples/lib/gitlab/import_export/import_failure_service_shared_examples.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +shared_examples 'log import failure' do |importable_column| + it 'tracks error' do + extra = { + relation_key: relation_key, + relation_index: relation_index, + retry_count: retry_count + } + extra[importable_column] = importable.id + + expect(Gitlab::ErrorTracking).to receive(:track_exception).with(exception, extra) + + subject.log_import_failure(relation_key, relation_index, exception, retry_count) + end + + it 'saves data to ImportFailure' do + log_import_failure + + import_failure = ImportFailure.last + + aggregate_failures do + expect(import_failure[importable_column]).to eq(importable.id) + expect(import_failure.relation_key).to eq(relation_key) + expect(import_failure.relation_index).to eq(relation_index) + expect(import_failure.exception_class).to eq('StandardError') + expect(import_failure.exception_message).to eq(standard_error_message) + expect(import_failure.correlation_id_value).to eq(correlation_id) + expect(import_failure.retry_count).to eq(retry_count) + end + end +end |