debian-mirror-gitlab/app/services/ci/compare_test_reports_service.rb

32 lines
909 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
module Ci
2019-02-15 15:39:39 +05:30
class CompareTestReportsService < CompareReportsBaseService
def comparer_class
Gitlab::Ci::Reports::TestReportsComparer
2018-11-18 11:00:15 +05:30
end
2019-02-15 15:39:39 +05:30
def serializer_class
TestReportsComparerSerializer
2018-11-18 11:00:15 +05:30
end
2019-02-15 15:39:39 +05:30
def get_report(pipeline)
pipeline&.test_reports
2018-11-18 11:00:15 +05:30
end
2021-01-29 00:20:46 +05:30
def build_comparer(base_report, head_report)
# We need to load the test failure history on the test comparer because we display
# this on the MR widget
super.tap do |test_reports_comparer|
::Gitlab::Ci::Reports::TestFailureHistory.new(failed_test_cases(test_reports_comparer), project).load!
end
end
def failed_test_cases(test_reports_comparer)
test_reports_comparer.suite_comparers.flat_map do |suite_comparer|
suite_comparer.limited_tests.new_failures + suite_comparer.limited_tests.existing_failures
end
end
2018-11-18 11:00:15 +05:30
end
end