Commit 6e39022e authored by George Koltsov's avatar George Koltsov

Update NdjsonPipeline#transform to return if data is nil

parent a02124bc
......@@ -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