Update README to address Simplecov intermittently dropping coverage#123
Open
darronschall wants to merge 1 commit into
Open
Update README to address Simplecov intermittently dropping coverage#123darronschall wants to merge 1 commit into
darronschall wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
After first integrating flatware, I've seen 2% drops in coverage in every 1-in-3 full suite runs, with a different worker missing from the final
Coverage report generated for ...listing each time.From what I can tell,
flatware rspecreturns to its top-levelexitthe moment the DRb sink has seen every worker report its final result — but a worker'sat_exit(where SimpleCov stores its resultset slice to disk) runs after the last DRb report goes over the wire. So the parent's own SimpleCovat_exit(which merges all workers' slices into the final report) can fire before the slowest worker finishes writing.The solution appears to be adding a
Process.waitallbarrier inside anat_exitregistered frombefore_fork(afterrequire 'rails_helper'has loaded SimpleCov). LIFO at_exit ordering means the barrier fires before SimpleCov's at_exit, so the merge sees the full set of workers' resultsets. The handler is gated toProcess.pid == parent_pid; it no-ops in worker forks.I'm running this setup in production now and have not seen any coverage drops.
Also, while I had the SimpleCov section open, I added a note for the
SimpleCov.minimum_coverage_by_file 0companion call in the after_fork example, since SimpleCov's defaultat_forklambda clears the aggregateminimum_coveragegate but not the per-file one (so workers using the per-file gate kill themselves before their slice can merge).