diff options
Diffstat (limited to 'spec/lib/bulk_imports/pipeline/runner_spec.rb')
-rw-r--r-- | spec/lib/bulk_imports/pipeline/runner_spec.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/spec/lib/bulk_imports/pipeline/runner_spec.rb b/spec/lib/bulk_imports/pipeline/runner_spec.rb index a88e8fb50d3..72e5e16a5b4 100644 --- a/spec/lib/bulk_imports/pipeline/runner_spec.rb +++ b/spec/lib/bulk_imports/pipeline/runner_spec.rb @@ -55,13 +55,11 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do shared_examples 'failed pipeline' do |exception_class, exception_message| it 'logs import failure' do expect_next_instance_of(BulkImports::Logger) do |logger| + expect(logger).to receive(:with_entity).with(context.entity).and_call_original expect(logger).to receive(:error) .with( a_hash_including( - 'bulk_import_entity_id' => entity.id, 'bulk_import_id' => entity.bulk_import_id, - 'bulk_import_entity_type' => entity.source_type, - 'source_full_path' => entity.source_full_path, 'pipeline_step' => :extractor, 'pipeline_class' => 'BulkImports::MyPipeline', 'exception.class' => exception_class, @@ -69,8 +67,7 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do 'correlation_id' => anything, 'class' => 'BulkImports::MyPipeline', 'message' => 'An object of a pipeline failed to import', - 'exception.backtrace' => anything, - 'source_version' => entity.bulk_import.source_version_info.to_s + 'exception.backtrace' => anything ) ) end @@ -94,6 +91,7 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do it 'logs a warn message and marks entity and tracker as failed' do expect_next_instance_of(BulkImports::Logger) do |logger| + expect(logger).to receive(:with_entity).with(context.entity).and_call_original expect(logger).to receive(:warn) .with( log_params( @@ -198,7 +196,8 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do expect(context.bulk_import).to receive(:touch) expect(context.entity).to receive(:touch) - expect_next_instance_of(Gitlab::Import::Logger) do |logger| + expect_next_instance_of(BulkImports::Logger) do |logger| + expect(logger).to receive(:with_entity).with(context.entity).and_call_original expect(logger).to receive(:info) .with( log_params( @@ -419,6 +418,7 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do entity.fail_op! expect_next_instance_of(BulkImports::Logger) do |logger| + expect(logger).to receive(:with_entity).with(context.entity).and_call_original expect(logger).to receive(:warn) .with( log_params( @@ -436,10 +436,6 @@ RSpec.describe BulkImports::Pipeline::Runner, feature_category: :importers do def log_params(context, extra = {}) { bulk_import_id: context.bulk_import_id, - bulk_import_entity_id: context.entity.id, - bulk_import_entity_type: context.entity.source_type, - source_full_path: entity.source_full_path, - source_version: context.entity.bulk_import.source_version_info.to_s, context_extra: context.extra }.merge(extra) end |