Commit be1b1384 authored by Stan Hu's avatar Stan Hu

Merge branch 'georgekoltsov/update-ndjson-pipeline' into 'master'

Update NdjsonPipeline#transform to return if data is nil

See merge request gitlab-org/gitlab!75107
parents 1ab0072e 6e39022e
......@@ -10,7 +10,12 @@ module BulkImports
ndjson_pipeline!
def transform(context, data)
return unless data
relation_hash, relation_index = data
return unless relation_hash
relation_definition = import_export_config.top_relation_tree(relation)
relation_object = deep_transform_relation!(relation_hash, relation, relation_definition) do |key, hash|
......
......@@ -130,6 +130,22 @@ RSpec.describe BulkImports::NdjsonPipeline do
subject.transform(context, data)
end
context 'when data is nil' do
before do
expect(Gitlab::ImportExport::Group::RelationFactory).not_to receive(:create)
end
it 'returns' do
expect(subject.transform(nil, nil)).to be_nil
end
context 'when relation hash is nil' do
it 'returns' do
expect(subject.transform(nil, [nil, 0])).to be_nil
end
end
end
end
describe '#load' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment