Commit 0599a25f authored by Steve Azzopardi's avatar Steve Azzopardi

Add has_trace to Projects::JobController#show.json

closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51925
parent c052f5a9
...@@ -7,6 +7,7 @@ class BuildDetailsEntity < JobEntity ...@@ -7,6 +7,7 @@ class BuildDetailsEntity < JobEntity
expose :coverage, :erased_at, :duration expose :coverage, :erased_at, :duration
expose :tag_list, as: :tags expose :tag_list, as: :tags
expose :has_trace?, as: :has_trace
expose :user, using: UserEntity expose :user, using: UserEntity
expose :runner, using: RunnerEntity expose :runner, using: RunnerEntity
expose :pipeline, using: PipelineEntity expose :pipeline, using: PipelineEntity
......
---
title: Expose has_trace in job API
merge_request: 21950
author:
type: other
...@@ -337,6 +337,22 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do ...@@ -337,6 +337,22 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end end
end end
end end
context 'when no trace is available' do
it 'has_trace is false' do
expect(response).to match_response_schema('job/job_details')
expect(json_response['has_trace']).to be false
end
end
context 'when job has trace' do
let(:job) { create(:ci_build, :running, :trace_live, pipeline: pipeline) }
it "has_trace is true" do
expect(response).to match_response_schema('job/job_details')
expect(json_response['has_trace']).to be true
end
end
end end
context 'when requesting JSON job is triggered' do context 'when requesting JSON job is triggered' do
......
...@@ -3,12 +3,16 @@ ...@@ -3,12 +3,16 @@
{ "$ref": "job.json" } { "$ref": "job.json" }
], ],
"description": "An extension of job.json with more detailed information", "description": "An extension of job.json with more detailed information",
"required": [
"has_trace"
],
"properties": { "properties": {
"artifact": { "$ref": "artifact.json" }, "artifact": { "$ref": "artifact.json" },
"terminal_path": { "type": "string" }, "terminal_path": { "type": "string" },
"trigger": { "$ref": "trigger.json" }, "trigger": { "$ref": "trigger.json" },
"deployment_status": { "$ref": "deployment_status.json" }, "deployment_status": { "$ref": "deployment_status.json" },
"runner": { "$ref": "runner.json" }, "runner": { "$ref": "runner.json" },
"runners": { "type": "runners.json" } "runners": { "type": "runners.json" },
"has_trace": { "type": "boolean" }
} }
} }
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