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

Ignore mocks in code coverage report #1851

Closed

Conversation

AndrewSirenko
Copy link
Contributor

Is this a bug fix or adding new feature?
bug fix

What is this PR about? / Why do we need it?
Currently our code coverage tool's per-package code-coverage is inaccurate due to our mock files being tracked by go test -coverprofile.

By appending _test to each mock file, go test will know that these files should not be counted towards the code-coverage score.

What testing is done?
make mockgen succeeds

NOTE: make verify fails when verifying govet with the following error:

Verifying govet
# github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver
vet: pkg/driver/mock_k8s_client_test.go:66:6: MockKubernetesClient redeclared in this block
# github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud
vet: pkg/cloud/mock_cloud_test.go:16:6: MockCloud redeclared in this block

But these files should be handled by make mockgen

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 5, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from andrewsirenko. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 5, 2023
@AndrewSirenko AndrewSirenko deleted the codeCoverageFix branch December 5, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants