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

Add Code coverage to PR #127

Open
gopinath-langote opened this issue Aug 24, 2019 · 9 comments
Open

Add Code coverage to PR #127

gopinath-langote opened this issue Aug 24, 2019 · 9 comments
Labels
documentation Create/Update documents good first issue Good for first time contributors Hacktoberfest Support to https://hacktoberfest.digitalocean.com/ help wanted Extra attention is needed remove Remove feature/tool/loginc
Milestone

Comments

@gopinath-langote
Copy link
Owner

@gopinath-langote gopinath-langote added documentation Create/Update documents remove Remove feature/tool/loginc labels Aug 24, 2019
@gopinath-langote gopinath-langote added this to the v2.0.0 milestone Aug 24, 2019
@gopinath-langote gopinath-langote added good first issue Good for first time contributors help wanted Extra attention is needed labels Aug 24, 2019
@amitlevy21
Copy link

@gopinath-langote I'd like to take a go ;) at this one

@gopinath-langote
Copy link
Owner Author

@amitlevy21 Thanks for picking up.

Let me know if you need any access things for Codecov https://codecov.io.

@gopinath-langote gopinath-langote added In Progress Someone working on the issue and removed help wanted Extra attention is needed labels Aug 26, 2019
@amitlevy21
Copy link

@gopinath-langote I am testing on a fork, codecov complains that the coverage file is empty. Running the following command:
go test -cover -race --coverprofile=coverage.txt -covermode=atomic ./testing -run .
Yields the following:
ok github.com/gopinath-langote/1build/testing 1.713s coverage: 0.0% of statements
I only found cli_test.go to be the only file with tests, am I correct? how come it says 0.0% is covered?

Output of coverage.txt:
mode: atomic

@amitlevy21
Copy link

@gopinath-langote
Copy link
Owner Author

I only found cli_test.go to be the only file with tests

Yes, That is the only file with test - other files are fixtures to create test data

@gopinath-langote
Copy link
Owner Author

There are integration tests not unit tests.

So It might not be trivial to get coverage,

Checkout https://www.cyphar.com/blog/post/20170412-golang-integration-coverage

@amitlevy21
Copy link

I found a simpler solution by using go test -v -coverpkg ./... ./...
See:
https://travis-ci.org/amitlevy21/1build/jobs/578187996
https://github.com/amitlevy21/1build/pull/1

Can I open a PR?

@gopinath-langote
Copy link
Owner Author

hello @amitlevy21 Thanks for the effort.
unfortunately, the coverage is not correct. Look at codecov generated by your commit:
https://codecov.io/gh/amitlevy21/1build/tree/e31f920171fc24b616f12acef34e261b89ebbe7d

I know this is not trivial to get coverage for such binary integration tests.

I'm also trying to figure out the way.

@amitlevy21
Copy link

amitlevy21 commented Sep 1, 2019

@gopinath-langote So from my understanding, Were seeing the wrong coverage rate because go test doesn't recognize the use of the cli via cobra, right?

I didn't find any issue regarding this in the cobra repository, should I create one?

@gopinath-langote gopinath-langote added Hacktoberfest Support to https://hacktoberfest.digitalocean.com/ help wanted Extra attention is needed and removed In Progress Someone working on the issue labels Sep 12, 2019
@gopinath-langote gopinath-langote modified the milestones: v1.3.0, v2.0.0 Sep 24, 2019
@gopinath-langote gopinath-langote modified the milestones: v1.4.0, v1.5.0 Oct 9, 2019
@gopinath-langote gopinath-langote modified the milestones: v1.5.0, v1.6.0 Apr 1, 2020
@gopinath-langote gopinath-langote modified the milestones: v1.6.0, v1.7.0 Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Create/Update documents good first issue Good for first time contributors Hacktoberfest Support to https://hacktoberfest.digitalocean.com/ help wanted Extra attention is needed remove Remove feature/tool/loginc
Projects
None yet
Development

No branches or pull requests

2 participants