TestFailureHistory badge does not include blocked pipelines in calculation
Proposal
Number of recent failures badge can be seen on the merge requests widget and when viewing a single Unit test. Currently, this badge only calculates failures that occurred in completed pipelines. Pipelines that are blocked (that have a manual job that wasn't triggered) are not counted towards total count of recent test failures on default branch.
This seems like an unnecessary requirement because if a pipeline success was required to register a flaky test, the test job would be forced to be made optional.
We should include tests available in blocked pipelines into calculation.
Relevant discussions: https://gitlab.com/gitlab-com/ops-sub-department/section-ops-request-for-help/-/issues/231
Technical Implementation Proposal
- after_transition any => ::Ci::Pipeline.completed_statuses do |pipeline|
+ after_transition any => ::Ci::Pipeline.completed_statuses + ::Ci::Pipeline.blocked_statuses do |pipeline|
pipeline.run_after_commit do
::Ci::TestFailureHistoryService.new(pipeline).async.perform_if_needed # rubocop: disable CodeReuse/ServiceClass
end
end
Documentation update
Once implemented, we shold revert the Document TestFailureHistory badge MR.