-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
KAFKA-3451: Add basic HTML coverage report generation to gradle #1121
Conversation
debug("Checker method is not passed skipping zkData match") | ||
warn("Conditional update of path %s with data %s and expected version %d failed due to %s" | ||
.format(path, data,expectVersion, e1.getMessage)) | ||
(false, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This minimal change was made because the old "style" broke the Scoverage code instrumentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit concerning that valid Scala code breaks scoverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the bright side, it encourages better coding practice. ;)
Thanks for the PR @granthenke. I think it would be good to explain a bit more how this hooks into the build. Is it just a command that can be run explicitly, but it doesn't change anything else otherwise (i.e. no slowdown in compilation or test execution speed)? Or does it instrument things by default? |
@ijuma This just adds optional tasks to the build to generate the report output. It should not affect the existing build workflow. I didn't make it part of the default build for a few reasons:
Eventually we may want to incorporate it and coverage checks into the standard build, but for now I wanted the basic ability to report coverage. |
Grant, thanks for restarting this. Code coverage is a useful tool to make sure new patches are coming with proper unit tests. However, it will be hard to say so without some sort of a baseline number. Having a consolidated report, for scala and java code, can give us a reference number. In parent JIRA that is what I tried to achieve. Many projects are already taking advantage of sonarqube, https://analysis.apache.org/. It will be nice to have Kafka take advantage of it as well. |
@SinghAsDev Yes, those features could definitely be useful. I left that out of the scope of this patch (KAFKA-3451) and it still can be done under the parent patch KAFKA-1722. Since that looked to be a longer discussion, this gets some functionality now. Please feel free to drive that addition after this patch. |
Yea, that is what I meant, just wanted to provide the bigger picture here. @ijuma I think having a separate task will make sure people don't have to unnecessarily wait for coverage reports and coverage reports builds can run the required task. |
Thanks for clarifying Grant. My preference is definitely for a separate task, so that's good. |
It looks like checking coverage actually runs the tests. Is this expected? |
I think so. The reason is that the tests must run after the code is instrumented so that coverage can be recorded. |
repositories { | ||
mavenCentral() | ||
jcenter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't actually seem necessary based on the couple of targets I built? I'm not even sure what dependencies needed this? Same is true of the jcenter()
reference at buildscript
level, although that wasn't introduced in this patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will double check and remove it if its not needed.
@gwenshap Yeah, I think this is expected. It doesn't, however, seem to obey the same parallelism as normal tests. Unfortunate, but hopefully fixable in a follow up. I previously started to review this and then got sidetracked as the test run took about 40 minutes to execute :) Overall, I'm +1 on this pretty non-risky patch that makes an awesome incremental step towards Kafka actually paying attention to test coverage. Left one question, but otherwise LGTM |
+1 as well. I like the report :) I was a bit concerned by the time it took, but looks like this is inevitable. |
@ewencp @gwenshap Yeah the java runs aren't as bad, and if you like you can run a report on just the modules you care about. The Scala coverage report definitely takes a while. Thats why I have made this an optional task to start. Hopefully we can speed this up in the future. Speeding up core tests in general would be nice too. |
Author: Grant Henke <[email protected]> Reviewers: Gwen Shapira, Ismael Juma, Ewen Cheslack-Postava Closes #1121 from granthenke/coverage (cherry picked from commit 623ab1e) Signed-off-by: Gwen Shapira <[email protected]>
This PR seems to cause issues to the Gradle import of IntelliJ 2016.1.1. References to test classes are marked as red. If I revert to the commit before this and I re-import then things work fine. Anyone one else tested this? |
@ijuma I tested it with Intellij 15.0.3 and had no issues. I will update my Intellij and report back. |
@ijuma I didn't have any issues. You could try refreshing the gradle project, file -> synchronize, or file -> invalidate caches. |
@granthenke I did both before asking the question. I'll try a clean checkout as well. You checked test files, yes? |
@ijuma It looks like this is a regression in Intellij that is exposed when 2 modules point to the same source. It is tracked by IDEA-154014, IDEA-153264, and IDEA-153231. It can be worked around by going to |
Oh, that's really annoying because it will probably break every time one reloads the gradle build (ie when changing branches). Thanks for finding the issues in the IntelliJ tracker. |
The latest IntelliJ 2016.1 EAP fixes this issue: https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+2016.1+145.844.1+Release+Notes |
No description provided.