-
Notifications
You must be signed in to change notification settings - Fork 101
test(utils): improve client.go coverage 79.4% to 94.1% #579
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
base: main
Are you sure you want to change the base?
test(utils): improve client.go coverage 79.4% to 94.1% #579
Conversation
Signed-off-by: Yuvraj Kolkar <[email protected]>
bupd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuvraj-kolkar17 Thanks for your contribution
https://github.com/goharbor/harbor-cli/actions/runs/19942620956/attempts/2#summary-57184500419
Please fix the above formatting issue and fix lint
Make sure the CI passes and ping me for review. :)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #579 +/- ##
=========================================
- Coverage 10.99% 6.52% -4.47%
=========================================
Files 173 260 +87
Lines 8671 12842 +4171
=========================================
- Hits 953 838 -115
- Misses 7612 11902 +4290
+ Partials 106 102 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks @bupd for the feedback |
Signed-off-by: Yuvraj Kolkar <[email protected]>
|
hi @bupd , I’ve made the requested changes and updated the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances test coverage for pkg/utils/client.go by adding three new test cases that exercise previously untested error handling paths in the client initialization logic. The tests target specific error scenarios: empty credential names, invalid credential names, and password decryption failures.
- Adds comprehensive error path testing for
GetClient()andGetClientByCredentialName()functions - Increases test coverage from 79.4% to 94.1% through targeted error scenario tests
- Introduces
syncpackage import to support singleton reset patterns in tests
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bupd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run gofmt -s -w . to fix the lint issues
Thanks
Signed-off-by: Yuvraj Kolkar <[email protected]>
|
PTAL @bupd |
Description
Increases test coverage for
pkg/utils/client.gofrom 79.4% to 100% by adding tests for uncovered error handling scenarios.New Test Cases
TestGetClient_EmptyCredentialName- Tests empty credential name errorTestGetClient_InvalidCredentialName- Tests non-existent credential errorTestGetClientByCredentialName_DecryptionError- Tests password decryption errorImpact