Fix: Detect and fail when workers crash after test execution but before writing result files #1062
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When a child process crashes unexpectedly (e.g., due to out-of-memory errors) after executing tests but before writing result/coverage files, Paratest would silently ignore the missing files and exit with code 0. This causes false-positive CI pipeline passes despite test failures.
Scenario
application->end()completesSolution
Added validation to ensure all workers that executed tests have written their result and coverage files. If files are missing, throw
MissingResultsExceptionwith a clear error message.Changes
WrapperWorker::hasExecutedTests()to track which workers ran testsWrapperRunner::$requiredTestResultFilesand$requiredCoverageFilesto track file paths that must existMissingResultsExceptionwith actionable error message when files are missingTesting
MissingResultsExceptionunit tests verify exception behaviourFixes
Addresses the issue where Paratest would pass CI despite worker crashes when using
--passthru-php='-dmemory_limit=1G'or similar memory constraints.Screenshot
Screenshot demonstrating the exception raising when test result files are missing for a given worker: