Skip to content

fix: Improve code coverage reporting in codecov #2715

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

Merged
merged 5 commits into from
Jul 25, 2022

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jun 29, 2022

This PR makes some small tweaks to code coverage reporting in codecov.

We don't need to provide github.com/coder/coder/codersdk explicitly as coverpkg since we're already passing all packages via ./.... In .vscode/settings.json this was set to ./. which didn't match any package => changed to ./....

When viewing the reports on codecov.io I noticed that some lines that should be covered, were not. I believe this stems from us uploading short coverage reports from the mock database run. It should be sufficient to only upload from the postgres test. The downside is that it's the flakier test, so it might take a while before the coverage can be observed. This is actually most likely due to the postgres test failing so often.

Finally, the *test packages where added to coverage ignore. Although, thanks to -coverpkg=./... they have great coverage, but I don't think it's a meaningful metric for us to include (they're essentially test code in public packages).

Side note: I realized codecov reports lines covered whereas go reports statements, I believe this is a reason our coverage appears worse on codecov than reported by go test -cover.

  • fix: Remove explicit coverpkg github.com/coder/coder/codersdk
  • fix: Stop uploading short / mock db test coverage
  • fix: Ignore test utils in coverage (clitest, coderdtest, ptytest)

@mafredri mafredri self-assigned this Jun 29, 2022
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

Awesome!

@github-actions github-actions bot added stale This issue is like stale bread. and removed stale This issue is like stale bread. labels Jul 23, 2022
@mafredri mafredri marked this pull request as ready for review July 25, 2022 16:54
@mafredri mafredri merged commit d7dee2c into main Jul 25, 2022
@mafredri mafredri deleted the mafredri/coverage-updates branch July 25, 2022 16:55
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.

2 participants