cyberark / secretless-broker

Secure your apps by making them Secretless
Apache License 2.0
234 stars 42 forks source link

Add empty tests to force go to include coverage for dirs without tests #1454

Closed diverdane closed 2 years ago

diverdane commented 2 years ago

Desired Outcome

Currently, the Golang code coverage automated tests that are run via Jenkins are not including Go packages that don't have any Go test files. If we want accurate code coverage reports, then these packages should be reported as having 0% coverage and included in the overall coverage report. Otherwise, we're overestimating our actual code coverage.

Implemented Changes

For all Go package directories that don't have any Go tests, a file is temporarily added called empty_test.go that only includes a package statement (and some comments). This will force Go to include the package in coverage reports as being 0% covered.

The empty_test.go files should be deleted whenever Go tests are actually added to each package.

Connected Issue/Story

CyberArk internal issue link: ONYX-17302

Definition of Done

Changelog

Test coverage

Documentation

Behavior

Security

codeclimate[bot] commented 2 years ago

Code Climate has analyzed commit 7a517ab8 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 34.9% (-19.8% change).

View more on Code Climate.