Commit 88cc49fa authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add test for restoring associations with import/export

parent b1e1990e
...@@ -6465,6 +6465,26 @@ ...@@ -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": [ "statuses": [
{ {
"id": 71, "id": 71,
...@@ -6487,6 +6507,7 @@ ...@@ -6487,6 +6507,7 @@
"stage": "test", "stage": "test",
"trigger_request_id": null, "trigger_request_id": null,
"stage_idx": 1, "stage_idx": 1,
"stage_id": 11,
"tag": null, "tag": null,
"ref": "master", "ref": "master",
"user_id": null, "user_id": null,
...@@ -6515,15 +6536,16 @@ ...@@ -6515,15 +6536,16 @@
"runner_id": null, "runner_id": null,
"coverage": null, "coverage": null,
"commit_id": 36, "commit_id": 36,
"commands": "$ build command", "commands": "$ deploy command",
"job_id": null, "job_id": null,
"name": "test build 2", "name": "test build 2",
"deploy": false, "deploy": false,
"options": null, "options": null,
"allow_failure": false, "allow_failure": false,
"stage": "test", "stage": "deploy",
"trigger_request_id": null, "trigger_request_id": null,
"stage_idx": 1, "stage_idx": 1,
"stage_id": 12,
"tag": null, "tag": null,
"ref": "master", "ref": "master",
"user_id": null, "user_id": null,
......
...@@ -179,6 +179,18 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -179,6 +179,18 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
end end
end 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
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