Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid premature failure with parallel_tests #706

Conversation

f1sherman
Copy link
Contributor

@f1sherman f1sherman commented Dec 9, 2018

When running within parallel_tests, wait until all test processes complete before evaluating coverage statistics. This avoids a premature failure exit code if an early run finishes with coverage that does not meet the configured criteria. I believe this will fix #559. There are a few different approaches I could see to resolve this issue, feedback welcome of course!

When running within
[parallel_tests](https://github.com/grosser/parallel_tests/wiki), wait
until all test processes complete before evaluating coverage statistics.
This avoids a premature failure exit code if an early run finishes with
coverage that does not meet the configured criteria.
@f1sherman f1sherman force-pushed the fix-minimum-coverage-with-parallel-tests branch from 1137200 to a3faac1 Compare December 9, 2018 20:08
@tavlima
Copy link

tavlima commented Jun 14, 2019

Any ETA for a release including this fix?

Copy link
Collaborator

@PragTob PragTob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, I like the usage of ParallelTest APIs although that binds us to its API pretty much. I think this will have to be re-evaluated when a new gem doing this emerges... wasn't Rails 6 supposed to ship with something to that tune? Well, we'll see...

Thanks for taking the time to tackle this difficult issue 💚

Sorry for the long response time, I took a bit of a break from maintaining simplecov.

I'll address the things I found because I think they're easy to address no need to wait on you after you waited so long for me :)

IMG_20190127_150119

@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SimpleCov
VERSION = "0.16.1".freeze
VERSION = "0.16.2".freeze
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping versions is usually more of a maintainer choice (with a lot of the other fixes I'll probably go for 0.17.0) so I think it's fine to keep as is before result :)

@@ -220,7 +221,7 @@ def process_result(result, exit_status)
if result_exit_status == SimpleCov::ExitCodes::SUCCESS # No result errors
write_last_run(covered_percent)
end
result_exit_status
final_result_process? ? result_exit_status : SimpleCov::ExitCodes::SUCCESS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could be simplified. I guess the thinking here is that we'll always say it's success unless we were the last process? Might be nice to say in a comment or something.

@PragTob
Copy link
Collaborator

PragTob commented Jun 25, 2019

@tavlima I'll try to cut a new release in the coming days, no promises though.

@PragTob
Copy link
Collaborator

PragTob commented Jun 25, 2019

Merged as 318b212

@PragTob PragTob closed this Jun 25, 2019
annaswims added a commit to department-of-veterans-affairs/vets-api that referenced this pull request Sep 10, 2019
annaswims added a commit to department-of-veterans-affairs/vets-api that referenced this pull request Sep 10, 2019
* Update simeplecov gem to fix parallel_test coverage bug

simplecov-ruby/simplecov#706

* don't chane bundle version
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 2, 2019
Update ruby-simplecov to 0.17.1.


0.17.1 (2019-09-16)
===================

Bugfix release for problems with ParallelTests.

## Bugfixes

* Avoid hanging with parallel_tests. See [#746](simplecov-ruby/simplecov#746) (thanks [@annaswims](https://github.com/annaswims))

0.17.0 (2019-07-02)
===================

Maintenance release with nice convenience features and important bugfixes.
Notably this **will be the last release to support ruby versions that have reached their end of life**. Moving forward official CRuby support will be 2.4+ and JRuby support will be 9.1+. Older versions might still work but no guarantees.

## Enhancements

* Per default filter hidden files and folders. See [#721](simplecov-ruby/simplecov#721) (thanks [Renuo AG](https://www.renuo.ch))
* Print the exit status explicitly when it's not a successful build so it's easier figure out SimpleCov failed the build in the output. See [#688](simplecov-ruby/simplecov#688) (thanks [@daemonsy](https://github.com/daemonsy))

## Bugfixes

* Avoid a premature failure exit code when setting `minimum_coverage` in combination with using [parallel_tests](https://github.com/grosser/parallel_tests). See [#706](simplecov-ruby/simplecov#706) (thanks [@f1sherman](https://github.com/f1sherman))
* Project roots with special characters no longer cause crashes. See [#717](simplecov-ruby/simplecov#717) (thanks [@deivid-rodriguez](https://github.com/deivid-rodriguez))
* Avoid continously overriding test results with manual `ResultMergere.store_results` usage. See [#674](simplecov-ruby/simplecov#674) (thanks [@tomeon](https://github.com/tomeon))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I am experiencing race condition while using SimpleCov with Parallel_tests
4 participants