diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-04 13:00:02 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-04 13:00:02 +0100 |
commit | 88cc49fa17d212e087f6e8a5aec0b2a680cec6e3 (patch) | |
tree | 9d486158fec210a83b84a0d4ec9e8b79ac738a49 /spec/lib/gitlab | |
parent | b1e1990ee263bcae73f0e55526a55cff66103220 (diff) | |
download | gitlab-ce-88cc49fa17d212e087f6e8a5aec0b2a680cec6e3.tar.gz |
Add test for restoring associations with import/export
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/import_export/project.json | 26 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/project_tree_restorer_spec.rb | 12 |
2 files changed, 36 insertions, 2 deletions
diff --git a/spec/lib/gitlab/import_export/project.json b/spec/lib/gitlab/import_export/project.json index f0752649121..6778b23ee7f 100644 --- a/spec/lib/gitlab/import_export/project.json +++ b/spec/lib/gitlab/import_export/project.json @@ -6465,6 +6465,26 @@ } } ], + "stages": [ + { + "id": 11, + "project_id": 5, + "pipeline_id": 36, + "name": "test", + "status": 1, + "created_at": "2016-03-22T15:44:44.772Z", + "updated_at": "2016-03-29T06:44:44.634Z" + }, + { + "id": 12, + "project_id": 5, + "pipeline_id": 36, + "name": "deploy", + "status": 2, + "created_at": "2016-03-22T15:45:45.772Z", + "updated_at": "2016-03-29T06:45:45.634Z" + } + ], "statuses": [ { "id": 71, @@ -6487,6 +6507,7 @@ "stage": "test", "trigger_request_id": null, "stage_idx": 1, + "stage_id": 11, "tag": null, "ref": "master", "user_id": null, @@ -6515,15 +6536,16 @@ "runner_id": null, "coverage": null, "commit_id": 36, - "commands": "$ build command", + "commands": "$ deploy command", "job_id": null, "name": "test build 2", "deploy": false, "options": null, "allow_failure": false, - "stage": "test", + "stage": "deploy", "trigger_request_id": null, "stage_idx": 1, + "stage_id": 12, "tag": null, "ref": "master", "user_id": null, diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index 0ab3afd0074..d4342f2b1a8 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -179,6 +179,18 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do end end end + + context 'when restoring hierarchy of pipeline, stages and jobs' do + let(:pipeline) { Ci::Pipeline.first } + + it 'restores pipeline stages' do + expect(pipeline.stages.count).to be 2 + end + + it 'correctly restores association between a stage and a job' do + expect(pipeline.statuses).to all(have_attributes(stage_id: a_value > 10)) + end + end end end |