Skip to content

Conversation

@Adirio
Copy link
Contributor

@Adirio Adirio commented Feb 17, 2021

By default coverage only is accounted for LoC in the same package as the tests.
If you provide -coverpkg you can specify a list of packages that will be taken into account when creating the coverage report.
This allows tests in a package to be used to provide coverage for other packages in the provided list.

Impact on covered files

As a side-effect, the list of files that are being covered is slightly different.

The following files were considered previously by coverage and are no longer:

  • pkg/plugins/golang/v2/api.go
  • pkg/plugins/golang/v2/edit.go
  • pkg/plugins/golang/v2/init.go
  • pkg/plugins/golang/v2/options.go
  • pkg/plugins/golang/v2/plugin.go
  • pkg/plugins/golang/v2/webhook.go

All of them, exept for pkg/plugins/golang/v2/options.go were not being tested and had a 0% coverage, as this is being tested with integration tests. Loosing coverage on pkg/plugins/golang/v2/options.go which is at a 96.5% covered doesn't seem to big of an issue. Additionally, this file is going to disapear in plugin phase 1.5.

On the other hand, files that were not considered previously by coverage are being taken into account now:

  • pkg/internal/validation/dns.go
  • pkg/model/file/errors.go
  • pkg/model/file/funcmap.go
  • pkg/model/file/marker.go
  • pkg/model/file/mixins.go
  • pkg/model/plugin.go
  • pkg/model/universe.go
  • pkg/plugins/internal/cmdutil/cmdutil.go

So summing up, we are just removing coverage from a file that is going to disapear and currently has 96.5% to add 8 new files that will stay and were not covered before.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 17, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Adirio

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 17, 2021
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 17, 2021
@Adirio Adirio force-pushed the increase-coverage branch 2 times, most recently from 44dda42 to c1f79eb Compare February 17, 2021 13:44
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 17, 2021
@Adirio Adirio changed the title 🌱 Increase coverage 🌱 Enable cross-package coverage Feb 17, 2021
@Adirio Adirio marked this pull request as ready for review February 17, 2021 14:29
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 17, 2021
@DirectXMan12
Copy link
Contributor

I think this is a reasonable tradeoff. I think permitting cross-package coverage makes senses in some cases, so I'm on board with this.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 17, 2021
@k8s-ci-robot k8s-ci-robot merged commit 2d9367e into kubernetes-sigs:master Feb 17, 2021
@Adirio Adirio deleted the increase-coverage branch February 17, 2021 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants