Skip to content

Conversation

@chethanv28
Copy link
Collaborator

@chethanv28 chethanv28 commented Nov 12, 2025

What this PR does / why we need it:
PR is adding Code coverage analysis for existing unit tests & then use the summary in make build.
As of today we have a very low overall code coverage. So, adding a check for overall code coverage does not make sense. But for the existing unit tests & any new tests that get added in the future we will have threshold of 75% coverage in amek build process itself.

The make build will execute the below steps:
✅ Compile the binaries
✅ Run unit tests with coverage
✅ Validate that tested functions have good coverage (≥75%) (For existing unit tests or any new unit tests that get added)
❌ Fail the build if code coverage drops below 75% For existing unit tests or any new unit tests that get added)

This is not a PR to increase the code coverage but intent is to introduce the code coverage analysis tool for every new check-in from now on.

We will continue to print the below summary until we reach overall coverage goal of 75~80%

Analyzing coverage quality (excluding 0% functions)...
Total functions: 1180
Functions with 0% coverage: 775 (65.7%)
Functions with >0% coverage: 405 (34.3%)
Overall coverage (including 0%): 27.5% (Previously 15%)
Quality coverage (excluding 0%): 80.2%
SUCCESS: Quality coverage 80.2% meets threshold 75.0%
NOTE: Consider adding tests for 775 untested functions to improve overall coverage.
+ EXIT_VALUE=0
+ set +o xtrace
Cleaning up after docker in docker.

Testing done:
$ make build

[Terminal output truncated: ~805KB dropped from beginning]
driver/v3/pkg/common/config/config.go:333:										isValidvCenterUsernameWithDomain				100.0%
sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config/config.go:343:										validateConfig							69.5%
sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config/config.go:513:										ReadConfig							0.0%
sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config/config.go:531:										GetCnsconfig							0.0%
sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config/config.go:567:										GetDefaultNetPermission						100.0%
sigs.k8s.io/vsphere-csi-driver/v3/pkg/common/config/config.go:579:										FromEnvToGC							0.0%
...
...
total:																		(statements)							22.3%
Analyzing coverage quality (excluding 0% functions)...
Total functions: 1180
Functions with 0% coverage: 775 (65.7%)
Functions with >0% coverage: 405 (34.3%)
Overall coverage (including 0%): 27.5%
Quality coverage (excluding 0%): 80.2%
SUCCESS: Quality coverage 80.2% meets threshold 75.0%
NOTE: Consider adding tests for 775 untested functions to improve overall coverage.

Special notes for your reviewer:

Release note:

Code coverage for unit tests

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chethanv28

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

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 12, 2025
@chethanv28
Copy link
Collaborator Author

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Nov 12, 2025
@chethanv28 chethanv28 force-pushed the topic/chethanv28/add-code-coverage-summary branch from eff4de3 to bdecb15 Compare November 12, 2025 20:10
@chethanv28 chethanv28 requested review from deepakkinni and xing-yang and removed request for kolluria November 12, 2025 20:30
@chethanv28 chethanv28 changed the title Code coverage for unit tests Code coverage for existing unit tests Nov 12, 2025
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 13, 2025
@deepakkinni
Copy link
Collaborator

Triggering CSI-WCP Pre-checkin Pipeline for this PR... Job takes approximately an hour to complete
Jenkins Build #592

@deepakkinni
Copy link
Collaborator

SUCCESS --- Jenkins Build #592

@chethanv28
Copy link
Collaborator Author

/test pull-vsphere-csi-driver-verify-golangci-lint

@chethanv28 chethanv28 force-pushed the topic/chethanv28/add-code-coverage-summary branch from aabe655 to e6229a8 Compare January 2, 2026 03:46
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 2, 2026
@k8s-ci-robot
Copy link
Contributor

@chethanv28: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-vsphere-csi-driver-verify-golangci-lint 777e7c8 link true /test pull-vsphere-csi-driver-verify-golangci-lint
pull-vsphere-csi-driver-unit-test 777e7c8 link true /test pull-vsphere-csi-driver-unit-test
pull-vsphere-csi-driver-verify-staticcheck 777e7c8 link true /test pull-vsphere-csi-driver-verify-staticcheck
pull-vsphere-csi-driver-build 777e7c8 link true /test pull-vsphere-csi-driver-build

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

3 participants