diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /app/services/ci/test_cases_service.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/services/ci/test_cases_service.rb')
-rw-r--r-- | app/services/ci/test_cases_service.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/app/services/ci/test_cases_service.rb b/app/services/ci/test_cases_service.rb deleted file mode 100644 index 3139b567571..00000000000 --- a/app/services/ci/test_cases_service.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -module Ci - class TestCasesService - MAX_TRACKABLE_FAILURES = 200 - - def execute(build) - return unless Feature.enabled?(:test_failure_history, build.project) - return unless build.has_test_reports? - return unless build.project.default_branch_or_master == build.ref - - test_suite = generate_test_suite_report(build) - - track_failures(build, test_suite) - end - - private - - def generate_test_suite_report(build) - build.collect_test_reports!(Gitlab::Ci::Reports::TestReports.new) - end - - def track_failures(build, test_suite) - return if test_suite.failed_count > MAX_TRACKABLE_FAILURES - - test_suite.failed.keys.each_slice(100) do |keys| - Ci::TestCase.transaction do - test_cases = Ci::TestCase.find_or_create_by_batch(build.project, keys) - Ci::TestCaseFailure.insert_all(test_case_failures(test_cases, build)) - end - end - end - - def test_case_failures(test_cases, build) - test_cases.map do |test_case| - { - test_case_id: test_case.id, - build_id: build.id, - failed_at: build.finished_at - } - end - end - end -end |