summaryrefslogtreecommitdiff
path: root/spec/services/ci
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 15:09:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-03 15:09:56 +0000
commitc08d9c22569d1c9e7c7737e183969593394133d9 (patch)
tree8ce1722f852f8921656080e04f6c9e16fa71ddb5 /spec/services/ci
parent546ddc3f6ac96fdf09934390a938bb391d07dc94 (diff)
downloadgitlab-ce-c08d9c22569d1c9e7c7737e183969593394133d9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/ci')
-rw-r--r--spec/services/ci/daily_report_result_service_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/services/ci/daily_report_result_service_spec.rb b/spec/services/ci/daily_report_result_service_spec.rb
index 793fc956acb..240709bab0b 100644
--- a/spec/services/ci/daily_report_result_service_spec.rb
+++ b/spec/services/ci/daily_report_result_service_spec.rb
@@ -38,6 +38,27 @@ describe Ci::DailyReportResultService, '#execute' do
expect(Ci::DailyReportResult.find_by(title: 'extra')).to be_nil
end
+ context 'when there are multiple builds with the same group name that report coverage' do
+ let!(:test_job_1) { create(:ci_build, pipeline: pipeline, name: '1/2 test', coverage: 70) }
+ let!(:test_job_2) { create(:ci_build, pipeline: pipeline, name: '2/2 test', coverage: 80) }
+
+ it 'creates daily code coverage record with the average as the value' do
+ described_class.new.execute(pipeline)
+
+ Ci::DailyReportResult.find_by(title: 'test').tap do |coverage|
+ expect(coverage).to have_attributes(
+ project_id: pipeline.project.id,
+ last_pipeline_id: pipeline.id,
+ ref_path: pipeline.source_ref_path,
+ param_type: 'coverage',
+ title: test_job_2.group_name,
+ value: 75,
+ date: pipeline.created_at.to_date
+ )
+ end
+ end
+ end
+
context 'when there is an existing daily code coverage for the matching date, project, ref_path, and group name' do
let!(:new_pipeline) do
create(