summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSteve Azzopardi <steveazz@outlook.com>2018-09-06 12:21:58 +0200
committerSteve Azzopardi <steveazz@outlook.com>2018-09-13 17:31:52 +0200
commitc80abb40fcb3b2dc35c62aa30d374f2889247746 (patch)
tree6f966cd0fa0d3f6f9c139c89d00f00e1de873ce6 /spec
parentc7d1eef671dbf598814a6c2ff1f81b924583ae8a (diff)
downloadgitlab-ce-c80abb40fcb3b2dc35c62aa30d374f2889247746.tar.gz
Add retried jobs to pipeline stages
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50461
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb41
-rw-r--r--spec/fixtures/api/schemas/job/job.json4
-rw-r--r--spec/fixtures/api/schemas/pipeline_stage.json5
3 files changed, 39 insertions, 11 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index d89716b1b50..0d49033c691 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -193,14 +193,34 @@ describe Projects::PipelinesController do
context 'when accessing existing stage' do
before do
+ create(:ci_build, :retried, :failed, pipeline: pipeline, stage: 'build')
create(:ci_build, pipeline: pipeline, stage: 'build')
+ end
+
+ context 'without retried' do
+ before do
+ get_stage('build')
+ end
- get_stage('build')
+ it 'returns pipeline jobs without the retried builds' do
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to match_response_schema('pipeline_stage')
+ expect(json_response['latest_statuses'].length).to eq 1
+ expect(json_response).not_to have_key('retried')
+ end
end
- it 'returns html source for stage dropdown' do
- expect(response).to have_gitlab_http_status(:ok)
- expect(response).to match_response_schema('pipeline_stage')
+ context 'with retried' do
+ before do
+ get_stage('build', retried: true)
+ end
+
+ it 'returns pipelines jobs with the retried builds' do
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to match_response_schema('pipeline_stage')
+ expect(json_response['latest_statuses'].length).to eq 1
+ expect(json_response['retried'].length).to eq 1
+ end
end
end
@@ -214,12 +234,13 @@ describe Projects::PipelinesController do
end
end
- def get_stage(name)
- get :stage, namespace_id: project.namespace,
- project_id: project,
- id: pipeline.id,
- stage: name,
- format: :json
+ def get_stage(name, params = {})
+ get :stage, **params.merge(
+ namespace_id: project.namespace,
+ project_id: project,
+ id: pipeline.id,
+ stage: name,
+ format: :json)
end
end
diff --git a/spec/fixtures/api/schemas/job/job.json b/spec/fixtures/api/schemas/job/job.json
index f5d58b21e3d..734c535ef70 100644
--- a/spec/fixtures/api/schemas/job/job.json
+++ b/spec/fixtures/api/schemas/job/job.json
@@ -25,7 +25,9 @@
"playable": { "type": "boolean" },
"created_at": { "type": "string" },
"updated_at": { "type": "string" },
- "status": { "$ref": "../status/ci_detailed_status.json" }
+ "status": { "$ref": "../status/ci_detailed_status.json" },
+ "callout_message": { "type": "string" },
+ "recoverable": { "type": "boolean" }
},
"additionalProperties": true
}
diff --git a/spec/fixtures/api/schemas/pipeline_stage.json b/spec/fixtures/api/schemas/pipeline_stage.json
index f72988a3d3d..c01a1946185 100644
--- a/spec/fixtures/api/schemas/pipeline_stage.json
+++ b/spec/fixtures/api/schemas/pipeline_stage.json
@@ -16,6 +16,11 @@
"items": { "$ref": "job/job.json" },
"optional": true
},
+ "retried": {
+ "type": "array",
+ "items": { "$ref": "job/job.json" },
+ "optional": true
+ },
"status": { "$ref": "status/ci_detailed_status.json" },
"path": { "type": "string" },
"dropdown_path": { "type": "string" }