-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Proposal for coverage report implementation #200
Conversation
- Make coverage building part of make testlong - Add sending coverage report to codecov.io - Implement coverage with github.com/pierrre/gotestcover and remove coverage shell script
@@ -93,15 +95,16 @@ autotest: | |||
.PHONY: testlong | |||
testlong: | |||
go vet ./... | |||
$(GODEP) go test ./... | |||
make cover | |||
make -C tests test |
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.
Minor comment, but wouldn't make sense to do make cover
after the tests? Because I assume cover is slower and doesn't make sense to run it if the tests are failing.
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.
The reason I put it in here is that cover needs to run the tests again. At the moment it doesn't matter much as the test suite runs very fast. I see make test
as the fast option to run the tests and make testlong
is mainly used on the CI system and to do a final check locally.
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.
Ok, makes sense.
Nice, I like this. I left some minor comments. We need to make sure this doesn't break our Jenkins builds, but your changes seems to keep all target's functionality, so I think we're good. Anyway, I think the only way to find out is by merging, so I'll do that after you address the comments above. |
…t needed by default
I worried it could break some parts of the Jenkins implementation that is why I kept the changes to the Makefile to a minimum. I will keep an eye on the Jenkins build as soon as it is merged. I assume that is the one to look at? http://build-eu-00.elastic.co/job/packetbeat/ |
Two other things:
|
Good point. The parts depending on redis & elasticsearch were moved to libbeat and the tests with them. So we can safely remove those from here.
Can you make that a different PR, please? Would make sense if it helps to get a dev environment faster. |
I will open a different PR for the Docker part. Should I remove redis and elasticsearch with this one? |
Yes, that would be great, thanks! |
Done. I will try to open the Dockerfile pull request later today. |
You rock, @ruflin! :-) |
Proposal for coverage report implementation
Needed to keep Jenkins happy. #200
For documentation purpose. Here is the report for elastic/master: https://codecov.io/github/elastic/packetbeat |
@tsg The Docker implementation is a little bit delayed as the nose tests are sometimes flaky and I'm trying to figure out what the reason is. Is that a common issue? |
Proposal for coverage report implementation
Needed to keep Jenkins happy. elastic#200
I like it to have in my project a coverage report as part of the build. With the proposed changes below a coverage report is built on codecov.io with every pull request. An example report can be found here: https://codecov.io/github/ruflin/packetbeat?branch=coverage-implementation
During the implementation I stumbled over the issue that a travis build for a fork does not work by default as the package path (github.com/ruflin/packetbeat) inside the GOPATH is incorrect. I adjusted the .travis.yml file so the travis build also works for forks. I removed the line
as it didn't seem to be necessary anymore.
Golang can't produce coverage reports for multiple packages at once. This was so far done with the
coverage.sh
shell script. As this script had some issues on travis I replaced it with the github.com/pierrre/gotestcover go package from @pierrreI made generating the coverage part of testlong, as I think it makes sense to have it directly inside and brings the advantage that on travis the tests only have be run once.
Please let me know your thoughts on this proposal.