Clean up ImportExport::ProjectTreeRestorer
What
Clean up ImportExport::ProjectTreeRestorer#create_relations
after fix in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10356#note_26981713
Background
Before, iterating over default_relation_list and calling create_relation(relation_key, @tree_hash[relation_key.to_s])
could pass in create_relation(relation_key, nil)
and error out, if a new relation was added in lib/gitlab/import_export/relation_factory.rb and didn't exist in old exports.
This was caught by spec/features/projects/import_export/import_file_spec.rb:25
, which uses a fixed test_project_export.tar.gz
.
Why
This code has expanded over time and so there might be ways to clean it up. We should also review it for other possible bugs, which might help us solve https://gitlab.com/gitlab-org/gitlab-ce/issues/29714 at the same time.
We may want to increase test coverage, so similar errors are detected without the feature spec. We might also wish to make errors from import_file_spec.rb:25
clearer, as this was hard to diagnose from expected: "finished", got: "failed"
.