Fix flaky test that verifies secret push protection timeout
What does this MR do and why?
Problem
When RSpec's main process terminates and attempts to clean up child processes upon completion, it terminates subprocesses where the scans might be still ongoing. This behavior is not recognized by the upstream library (parallel), which manages all forked subprocesses it created for running scans. When the upstream library attempts to close its forked subprocesses which already terminated, it raises an ArgumentError
with the message bad signal type NilClass,
resulting in flaky failures in the test expectations.
Here's an example CI job that fails infrequently: https://gitlab.com/gitlab-org/gitlab/-/jobs/6935051992
Solution
Since the above problem occurs only in the test pipeline, I've rescued the problem-causing error in the spec.
Relevant Issue Numbers
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.