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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/import/import_failure_service_spec.rb')
-rw-r--r--spec/lib/gitlab/import/import_failure_service_spec.rb33
1 files changed, 21 insertions, 12 deletions
diff --git a/spec/lib/gitlab/import/import_failure_service_spec.rb b/spec/lib/gitlab/import/import_failure_service_spec.rb
index eb71b307b8d..a4682a9495e 100644
--- a/spec/lib/gitlab/import/import_failure_service_spec.rb
+++ b/spec/lib/gitlab/import/import_failure_service_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
+RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures, feature_category: :importers do
let_it_be(:import_type) { 'import_type' }
let_it_be(:project) { create(:project, :import_started, import_type: import_type) }
@@ -10,15 +10,18 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
let(:import_state) { nil }
let(:fail_import) { false }
let(:metrics) { false }
+ let(:external_identifiers) { {} }
+ let(:project_id) { project.id }
let(:arguments) do
{
- project_id: project.id,
+ project_id: project_id,
error_source: 'SomeImporter',
exception: exception,
fail_import: fail_import,
metrics: metrics,
- import_state: import_state
+ import_state: import_state,
+ external_identifiers: external_identifiers
}
end
@@ -33,7 +36,8 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
project_id: '_project_id_',
error_source: '_error_source_',
fail_import: '_fail_import_',
- metrics: '_metrics_'
+ metrics: '_metrics_',
+ external_identifiers: { id: 1 }
}
end
@@ -59,7 +63,7 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
subject(:service) { described_class.new(**arguments) }
shared_examples 'logs the exception and fails the import' do
- it 'when the failure does not abort the import' do
+ specify do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
@@ -67,7 +71,8 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
{
project_id: project.id,
import_type: import_type,
- source: 'SomeImporter'
+ source: 'SomeImporter',
+ external_identifiers: external_identifiers
}
)
@@ -76,10 +81,11 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
.with(
{
message: 'importer failed',
- 'error.message': 'some error',
+ 'exception.message': 'some error',
project_id: project.id,
import_type: import_type,
- source: 'SomeImporter'
+ source: 'SomeImporter',
+ external_identifiers: external_identifiers
}
)
@@ -95,7 +101,7 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
end
shared_examples 'logs the exception and does not fail the import' do
- it 'when the failure does not abort the import' do
+ specify do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
@@ -103,7 +109,8 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
{
project_id: project.id,
import_type: import_type,
- source: 'SomeImporter'
+ source: 'SomeImporter',
+ external_identifiers: external_identifiers
}
)
@@ -112,10 +119,11 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
.with(
{
message: 'importer failed',
- 'error.message': 'some error',
+ 'exception.message': 'some error',
project_id: project.id,
import_type: import_type,
- source: 'SomeImporter'
+ source: 'SomeImporter',
+ external_identifiers: external_identifiers
}
)
@@ -159,6 +167,7 @@ RSpec.describe Gitlab::Import::ImportFailureService, :aggregate_failures do
end
context 'when using the import_state as reference' do
+ let(:project_id) { nil }
let(:import_state) { project.import_state }
context 'when it fails the import' do