Added Unit test for pkg/util/discovery/discovery.go#267
Added Unit test for pkg/util/discovery/discovery.go#267GautamBytes wants to merge 2 commits intoopenkruise:masterfrom
Conversation
Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @GautamBytes! It looks like this is your first PR to openkruise/kruise-game 🎉 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #267 +/- ##
==========================================
+ Coverage 27.65% 31.14% +3.48%
==========================================
Files 94 96 +2
Lines 10450 11328 +878
==========================================
+ Hits 2890 3528 +638
- Misses 7358 7567 +209
- Partials 202 233 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: GautamBytes <manchandanigautam@gmail.com>
|
@ringtail , @chrisliu1995 , please rerun the workflow , the single failing workflow will pass then . |
|
@ringtail @furykerry just pinging to get a review . Thanks! |
What this PR does
This PR introduces comprehensive unit tests for the
pkg/util/discoverypackage, which previously had no test coverage.To enable testing, the core logic of
DiscoverGVKwas extracted into a privatediscoverGVKWithClientfunction. This refactoring allows for dependency injection of a mock discovery client, making the logic fully testable in isolation.Key Changes
DiscoverGVKfunction has been refactored to delegate its logic to a new private helper,discoverGVKWithClient, without changing any public-facing APIs.discovery_test.go, has been added with thorough test cases for:errors.IsNotFound()for robust error checking.