Welcome to mirror list, hosted at ThFree Co, Russian Federation.

import_failure_service_shared_examples.rb « import_export « gitlab « lib « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 67afd2035c4fb108becec43a4010a51e9df48e07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

RSpec.shared_examples 'log import failure' do |importable_column|
  it 'tracks error' do
    extra = {
      source: action,
      relation_name: 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(
      source: action,
      relation_key: relation_key,
      relation_index: relation_index,
      exception: exception,
      retry_count: 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.source).to eq(action)
      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