Commit e26b1efd authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '35341-expand-import-export-test-json' into 'master'

Fix `ci_cd_settings`, `project_feature` Import

Closes #36710

See merge request gitlab-org/gitlab!20174
parents df4f16bf 1875991c
...@@ -327,7 +327,12 @@ module Gitlab ...@@ -327,7 +327,12 @@ module Gitlab
end end
def find_or_create_object! def find_or_create_object!
return relation_class.find_or_create_by(project_id: @project.id) if UNIQUE_RELATIONS.include?(@relation_name) if UNIQUE_RELATIONS.include?(@relation_name)
unique_relation_object = relation_class.find_or_create_by(project_id: @project.id)
unique_relation_object.assign_attributes(parsed_relation_hash)
return unique_relation_object
end
# Can't use IDs as validation exists calling `group` or `project` attributes # Can't use IDs as validation exists calling `group` or `project` attributes
finder_hash = parsed_relation_hash.tap do |hash| finder_hash = parsed_relation_hash.tap do |hash|
......
...@@ -7209,15 +7209,15 @@ ...@@ -7209,15 +7209,15 @@
} }
], ],
"project_feature": { "project_feature": {
"builds_access_level": 0, "builds_access_level": 10,
"created_at": "2014-12-26T09:26:45.000Z", "created_at": "2014-12-26T09:26:45.000Z",
"id": 2, "id": 2,
"issues_access_level": 0, "issues_access_level": 10,
"merge_requests_access_level": 20, "merge_requests_access_level": 10,
"project_id": 4, "project_id": 4,
"snippets_access_level": 20, "snippets_access_level": 10,
"updated_at": "2016-09-23T11:58:28.000Z", "updated_at": "2016-09-23T11:58:28.000Z",
"wiki_access_level": 20 "wiki_access_level": 10
}, },
"custom_attributes": [ "custom_attributes": [
{ {
...@@ -7257,6 +7257,9 @@ ...@@ -7257,6 +7257,9 @@
"image_url": "http://www.example.com" "image_url": "http://www.example.com"
} }
], ],
"ci_cd_settings": {
"group_runners_enabled": false
},
"boards": [ "boards": [
{ {
"id": 29, "id": 29,
......
...@@ -48,11 +48,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -48,11 +48,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
it 'restore correct project features' do it 'restore correct project features' do
project = Project.find_by_path('project') project = Project.find_by_path('project')
expect(project.project_feature.issues_access_level).to eq(ProjectFeature::DISABLED) expect(project.project_feature.issues_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.builds_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.builds_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.snippets_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.snippets_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.wiki_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.wiki_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.merge_requests_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.merge_requests_access_level).to eq(ProjectFeature::PRIVATE)
end end
it 'has the project description' do it 'has the project description' do
...@@ -220,6 +220,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -220,6 +220,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'coffee') expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'coffee')
end end
it 'restores `ci_cd_settings` : `group_runners_enabled` setting' do
expect(@project.ci_cd_settings.group_runners_enabled?).to eq(false)
end
it 'restores the correct service' do it 'restores the correct service' do
expect(CustomIssueTrackerService.first).not_to be_nil expect(CustomIssueTrackerService.first).not_to be_nil
end end
......
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