Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-17 21:10:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-17 21:10:35 +0300
commit4484c8523126ee1de864bbcac43c706252d580be (patch)
tree5dff926e0deb8d55ce79c7c563f8fa7b1706a128 /spec/services
parent20dbd96076a6d09d20a9ac3caa1f35506d82340b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/daily_build_group_report_result_service_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/services/ci/daily_build_group_report_result_service_spec.rb b/spec/services/ci/daily_build_group_report_result_service_spec.rb
index e58a5de26a1..32651247adb 100644
--- a/spec/services/ci/daily_build_group_report_result_service_spec.rb
+++ b/spec/services/ci/daily_build_group_report_result_service_spec.rb
@@ -41,6 +41,17 @@ RSpec.describe Ci::DailyBuildGroupReportResultService, '#execute' do
expect(Ci::DailyBuildGroupReportResult.find_by(group_name: 'extra')).to be_nil
end
+ it 'creates a project_ci_feature_usage record for the pipeline project' do
+ described_class.new.execute(pipeline)
+
+ expect(Projects::CiFeatureUsage.count).to eq(1)
+ expect(Projects::CiFeatureUsage.first).to have_attributes(
+ project_id: pipeline.project.id,
+ feature: 'code_coverage',
+ default_branch: false
+ )
+ 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: 'test 1/2', coverage: 70) }
let!(:test_job_2) { create(:ci_build, pipeline: pipeline, name: 'test 2/2', coverage: 80) }
@@ -99,6 +110,16 @@ RSpec.describe Ci::DailyBuildGroupReportResultService, '#execute' do
data: { 'coverage' => new_karma_job.coverage }
)
end
+
+ it 'does not create a new project_ci_feature_usage record for the pipeline project' do
+ expect { described_class.new.execute(pipeline) }.not_to change { Projects::CiFeatureUsage.count }
+
+ expect(Projects::CiFeatureUsage.first).to have_attributes(
+ project_id: pipeline.project.id,
+ feature: 'code_coverage',
+ default_branch: false
+ )
+ end
end
context 'when the ID of the pipeline is older than the last_pipeline_id' do
@@ -161,6 +182,8 @@ RSpec.describe Ci::DailyBuildGroupReportResultService, '#execute' do
it 'does nothing' do
expect { described_class.new.execute(new_pipeline) }.not_to raise_error
+ expect(Ci::DailyBuildGroupReportResult.count).to eq(0)
+ expect(Projects::CiFeatureUsage.count).to eq(0)
end
end
@@ -178,6 +201,17 @@ RSpec.describe Ci::DailyBuildGroupReportResultService, '#execute' do
expect(coverage.default_branch).to be_truthy
end
end
+
+ it 'creates a project_ci_feature_usage record for the pipeline project for default branch' do
+ described_class.new.execute(pipeline)
+
+ expect(Projects::CiFeatureUsage.count).to eq(1)
+ expect(Projects::CiFeatureUsage.first).to have_attributes(
+ project_id: pipeline.project.id,
+ feature: 'code_coverage',
+ default_branch: true
+ )
+ end
end
context 'when pipeline ref_path is not the project default branch' do