-
Notifications
You must be signed in to change notification settings - Fork 27
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
Simplecov doesnt work with Knapsack Pro 7.4 and minitest #257
Comments
Hey, @rafaeelaudibert. I'm looking into it and will get back to you soon. |
I'm sorry for the troubles, Rafael. Unfortunately, I cannot reproduce the issue. I can see a line my terminal output that says:
and the Here are a few things that you could check:
If the above doesn't help, could you please share the following? Feel free to send it to support@knapsackpro.com if there's anything sensitive.
Or if it's easier, I'd be happy to debug a sample application if you can share a repo. |
@rafaeelaudibert Do you use other queue hooks than The only change for Minitest was a fix in 6.0.4. The 7.x release does not introduce changes to Minitest. Could you answer Riccardo's questions? That would help us narrow down the root issue. Thank you. |
I'm having some problems getting simplecov to work on my setup, but I've only tried 7.5.1 and haven't gotten simplecov to work with Knapsack thus far. I tried downgrading to 6.0.3 to see if that changed anything, but that caused it to fail with a VCR/WebMock-related error. I can provide more information once I dig into the problem a bit further. |
Ok, downgrading to 6.0.3 (after I fixed the VCR issue) does cause it to start emitting coverage files again! So I think the change in 6.0.4 needs to be rethought. |
Out of curiosity, does it matter if EDIT: It does not |
Are there any other code changes besides updating the knapsack_pro version? Does the test suite run rm -rf coverage or anything similar as part of running the tests? Maybe in a hook? Do you see the Coverage report generated for ... line in your CI node terminal output? Does Simplecov generate the report when you call Minitest directly (without Knapsack Pro)? Does running Knapsack Pro with KNAPSACK_PRO_LOG_LEVEL=debug log anything meaningful? Could you try to identify which specific version of Knapsack Pro in between 6.0.0 and 7.4.0 breaks Simplecov for you? |
On 7.5.1, if I add this to my test_helper.rb file, I get coverage reports again: KnapsackPro::Hooks::Queue.after_queue do
SimpleCov.result.format!
end I think this fully fixes both the coverage report not generating and the problem that was fixed by 6.0.4? EDIT: Sometimes the tests seem to get stuck at the very end of the process. I'm not sure why. We have 20 parallel jobs, 18 or 19 of them all finish within a few seconds of each other, and then sometimes the last 1 or 2 just get stuck. Other times they all pass fine at around the exact same time, and nothing gets stuck. |
The issue mentioned above seems to have something to do with the last job/jobs taking a lot longer than the other ones. Something about the logic for the queue mode seems to break or trigger a race condition when there's still one more job running tests while all the others have completed. At least, that seems to be the cause. And it's the only one I've come up with that really makes sense, given that the issue is inconsistent. Unfortunately, I don't have much to offer beyond that. |
Thanks @connorshea for detailed research. This is helpful.
It seems reasonable. Good findings.
You can debug the free with the following instructions: Add the following script to test_helper.rb. Thanks to that, you will see the backtrace showing what code line causes the hanging problem. Backtrace is visible only if the Ruby process got kill with USR1 signal. Learn more from this GitHub issue. # source https://github.com/rspec/rspec-rails/issues/1353#issuecomment-93173691
puts "Process pid: #{Process.pid}"
trap 'USR1' do
threads = Thread.list
puts
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
threads.each do |thr|
description = thr == Thread.main ? "Main thread" : thr.inspect
puts
puts "#{description} backtrace: "
puts thr.backtrace.join("\n")
end
puts "=" * 80
end If the CI provider does not kill the frozen process, you can do it by running the below command in the terminal (when you are ssh-ed into the CI node): kill -USR1 <process pid> Alternatively, you can use the timeout program to send the USR1 signal after Knapsack runs too long. timeout --signal=USR1 600 bundle exec rake "knapsack_pro:queue:rspec[--format d]" Notice that 600 is in seconds. It sends the signal after 10 minutes of running the command. You may want to adjust that number to ensure the USR1 signal is sent after the process is stuck and not before. |
@rafaeelaudibert Does adding the following help in your case? KnapsackPro::Hooks::Queue.after_queue do
SimpleCov.result.format!
end |
… + Queue Mode + simplecov Related: KnapsackPro/knapsack_pro-ruby#257
…st in Queue Mode after the knapsack_pro gem 6.0.4 release Related: KnapsackPro/knapsack_pro-ruby#257
I've updated the changelog for the 6.0.4 version to cover breaking changes affecting simplecov users. I also updated our simplecov docs: and CodeClimate + simplecov docs: |
@connorshea I think the issue with hanging tests is unrelated to the original simplecov issue. We could keep working on resolving hanging tests in the private support email thread that's been going on. I propose we close this GitHub issue as the original problem is solved. |
That first link is broken now since the branch was merged
That's fair! I'm fine with us closing this one unless Rafael needs any further help. |
I'll try the debugging steps you mentioned a bit later, I think switching to Regular Mode and forgoing code coverage has solved the issue we were having for now, regardless. |
@connorshea Good catch! I've updated my comment and the link. |
Hey!
I've been trying to update our Knapsack pro gem from version 6.0 to 7.4 but Im having problems with our minitest tests. We use
SimpleCov
alongside KnapsackPro but the output files are not being generated. There's nocoverage
folder anywhere after running the tests.This did work with Knapsack 6.0.
It's worth noticing that minitest is properly generating its XML output, and we're merging them as we did before. The only change is that simplecov is not generating output anymore. I've confirmed Simplecov is being properly initialized, and we have the following snippet in place - we had it in place with 6.0 as well.
Any idea on what could be causing this?
The text was updated successfully, but these errors were encountered: