-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
good first issueGood for beginnersGood for beginnershelp wantedFeatures that maintainers are willing to accept but do not have cycles to implementFeatures that maintainers are willing to accept but do not have cycles to implement
Description
Enforce the use of https://github.com/uber-go/goleak across the repo:
- a linter similar to scripts/check-test-files.sh that verifies that all packages with tests have goleak in TestMain
- first deploy the script in audit mode where it only prints offending packages
- then make the script fail the CI once the next item is addressed
- Done in Feature: add goleak to check goroutine leak in tests #5010
- add goleak to all packages via TestMain. Some packages may pass the validation, some may fail and would need to be fixed. It's best to break this into several PRs, first to add goleak to packages that do not fail, and then potentially separate PRs for each package where goleak does fail with the corresponding fixes to the tests.
- Run
make goleak
to see the list of packages missing the linter - In packages with multiple
*_test.go
files add the check to a new filepackage_test.go
- Remember to add copyright header - run
make fmt
after committing the new files
- Remember to add copyright header - run
- Examples:
- Run
- Fix leaks in the integration tests (see Add go leak checks to ES/OS tests #6339)
- Change linter script to fail CI on errors going forward
State on March 8 2024:
$ make goleak
Verifying that all packages with tests have goleak in their TestMain
🔴 Error(check-goleak): no goleak check in package ./cmd/collector/app/
🔴 Error(check-goleak): no goleak check in package ./cmd/internal/printconfig/
🔴 Error(check-goleak): no goleak check in package ./cmd/query/app/
🔴 Error(check-goleak): no goleak check in package ./pkg/cassandra/gocql/testutils/
🔴 Error(check-goleak): no goleak check in package ./pkg/testutils/
🔴 Error(check-goleak): no goleak check in package ./plugin/metrics/prometheus/metricsstore/
🔴 Error(check-goleak): no goleak check in package ./plugin/sampling/strategystore/adaptive/
🔴 Error(check-goleak): no goleak check in package ./plugin/storage/integration/
Error(check-goleak): no goleak check in 8 package(s).
akagami-harsh
Metadata
Metadata
Assignees
Labels
good first issueGood for beginnersGood for beginnershelp wantedFeatures that maintainers are willing to accept but do not have cycles to implementFeatures that maintainers are willing to accept but do not have cycles to implement