-
Notifications
You must be signed in to change notification settings - Fork 892
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
operator/pkg: depend on aggregator.Interface
instead of *aggregator.Clientset
#5602
operator/pkg: depend on aggregator.Interface
instead of *aggregator.Clientset
#5602
Conversation
aggregator.Interface
instead of *aggregator.Clientset
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5602 +/- ##
==========================================
+ Coverage 34.14% 35.19% +1.05%
==========================================
Files 643 645 +2
Lines 44524 44869 +345
==========================================
+ Hits 15203 15793 +590
+ Misses 28165 27846 -319
- Partials 1156 1230 +74
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
aggregator.Interface
instead of *aggregator.Clientset
aggregator.Interface
instead of *aggregator.Clientset
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
dddc3f8
to
6c490dc
Compare
Could we get this PR merged sooner? The unit test apiservice PR #5596, which depends on this, has been stale for a while. If anything is needed to move it forward, please let me know. Thanks! 🙏 |
Thanks~ |
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.
Thanks~
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: XiShanYongYe-Chang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
In this commit, we apply the Dependency Inversion Principle by depending on an interface instead of a concrete type. This improves flexibility and testability.
Motivation and Context
While testing the KarmadaResource API service operator package (#5596), I found it difficult to mock *aggregator.Clientset, complicating unit tests. By refactoring to depend on an interface, we improve flexibility and testability, allowing for the integration of a fake aggregator clientset since it implements that interface.
What type of PR is this?
/kind cleanup
Does this PR introduce a user-facing change?: