Commit f6a9650e authored by Maxime Orefice's avatar Maxime Orefice Committed by Stan Hu

Use default_branch for code coverage

This commits allow to fetch our code coverage data for the
default_branch with our graphql endpoint.
parent 180f2825
...@@ -153,6 +153,7 @@ module EE ...@@ -153,6 +153,7 @@ module EE
results = ::Ci::DailyBuildGroupReportResult results = ::Ci::DailyBuildGroupReportResult
.by_projects(project_ids) .by_projects(project_ids)
.with_coverage .with_coverage
.with_default_branch
.latest .latest
.summaries_per_project .summaries_per_project
......
...@@ -37,6 +37,7 @@ RSpec.describe 'Getting code coverage summary in a project' do ...@@ -37,6 +37,7 @@ RSpec.describe 'Getting code coverage summary in a project' do
end end
context 'when project has coverage' do context 'when project has coverage' do
context 'for the default branch' do
let!(:daily_build_group_report_result) { create(:ci_daily_build_group_report_result, project: project) } let!(:daily_build_group_report_result) { create(:ci_daily_build_group_report_result, project: project) }
it 'contains code coverage summary data', :aggregates_failures do it 'contains code coverage summary data', :aggregates_failures do
...@@ -48,6 +49,17 @@ RSpec.describe 'Getting code coverage summary in a project' do ...@@ -48,6 +49,17 @@ RSpec.describe 'Getting code coverage summary in a project' do
end end
end end
context 'not for the default branch' do
let!(:daily_build_group_report_result) { create(:ci_daily_build_group_report_result, :on_feature_branch, project: project) }
it 'returns nil' do
post_graphql(query, current_user: current_user)
expect(code_coverage_summary_graphql_data).to be_nil
end
end
end
context 'when project does not have coverage' do context 'when project does not have coverage' do
it 'returns nil' do it 'returns nil' do
post_graphql(query, current_user: current_user) post_graphql(query, current_user: current_user)
......
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