Commit e1732898 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'zj-expose-coverage-pipelines' into 'master'

Expose coverage on GET pipelines/:id

Closes gitlab-org/gitlab-ce#24801

See merge request !7670
parents 746b6ec8 752d72f8
---
title: 'API: expose pipeline coverage'
merge_request:
author:
......@@ -41,7 +41,8 @@ Example of response
"started_at": null,
"finished_at": null,
"committed_at": null,
"duration": null
"duration": null,
"coverage": "30.0"
},
{
"id": 48,
......@@ -64,7 +65,8 @@ Example of response
"started_at": null,
"finished_at": null,
"committed_at": null,
"duration": null
"duration": null,
"coverage": null
}
]
```
......@@ -110,7 +112,8 @@ Example of response
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null
"duration": null,
"coverage": "30.0"
}
```
......@@ -155,7 +158,8 @@ Example of response
"started_at": null,
"finished_at": null,
"committed_at": null,
"duration": null
"duration": null,
"coverage": null
}
```
......@@ -200,7 +204,8 @@ Response:
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null
"duration": null,
"coverage": null
}
```
......@@ -245,7 +250,8 @@ Response:
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null
"duration": null,
"coverage": null
}
```
......
......@@ -607,6 +607,7 @@ module API
expose :user, with: Entities::UserBasic
expose :created_at, :updated_at, :started_at, :finished_at, :committed_at
expose :duration
expose :coverage
end
class EnvironmentBasic < Grape::Entity
......
......@@ -103,6 +103,18 @@ describe API::API, api: true do
expect(json_response['message']).to eq '404 Not found'
expect(json_response['id']).to be nil
end
context 'with coverage' do
before do
create(:ci_build, coverage: 30, pipeline: pipeline)
end
it 'exposes the coverage' do
get api("/projects/#{project.id}/pipelines/#{pipeline.id}", user)
expect(json_response["coverage"].to_i).to eq(30)
end
end
end
context 'unauthorized user' do
......
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