Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6e39022e
Commit
6e39022e
authored
Nov 23, 2021
by
George Koltsov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update NdjsonPipeline#transform to return if data is nil
parent
a02124bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
lib/bulk_imports/ndjson_pipeline.rb
lib/bulk_imports/ndjson_pipeline.rb
+5
-0
spec/lib/bulk_imports/ndjson_pipeline_spec.rb
spec/lib/bulk_imports/ndjson_pipeline_spec.rb
+16
-0
No files found.
lib/bulk_imports/ndjson_pipeline.rb
View file @
6e39022e
...
@@ -10,7 +10,12 @@ module BulkImports
...
@@ -10,7 +10,12 @@ module BulkImports
ndjson_pipeline!
ndjson_pipeline!
def
transform
(
context
,
data
)
def
transform
(
context
,
data
)
return
unless
data
relation_hash
,
relation_index
=
data
relation_hash
,
relation_index
=
data
return
unless
relation_hash
relation_definition
=
import_export_config
.
top_relation_tree
(
relation
)
relation_definition
=
import_export_config
.
top_relation_tree
(
relation
)
relation_object
=
deep_transform_relation!
(
relation_hash
,
relation
,
relation_definition
)
do
|
key
,
hash
|
relation_object
=
deep_transform_relation!
(
relation_hash
,
relation
,
relation_definition
)
do
|
key
,
hash
|
...
...
spec/lib/bulk_imports/ndjson_pipeline_spec.rb
View file @
6e39022e
...
@@ -130,6 +130,22 @@ RSpec.describe BulkImports::NdjsonPipeline do
...
@@ -130,6 +130,22 @@ RSpec.describe BulkImports::NdjsonPipeline do
subject
.
transform
(
context
,
data
)
subject
.
transform
(
context
,
data
)
end
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
end
describe
'#load'
do
describe
'#load'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment