-
Notifications
You must be signed in to change notification settings - Fork 572
backend: k8cache: add update and delete coverage to informer tests #4503
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?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ChayanDass 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 |
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 the test coverage for the experimental k8cache package by adding tests for Update and Delete informer events. Previously, the TestRunInformerToWatch test only covered Add events; this change ensures that cache invalidation works correctly for all three event types (Add, Update, and Delete).
Changes:
- Added
eventTypefield to test case structure to distinguish between add, update, and delete events - Added two new test cases: one for update events and one for delete events
- Implemented event-specific logic in a switch statement to trigger the appropriate Kubernetes client operations for each event type
- Fixed variable naming (schema → scheme) for consistency with Go conventions
- Added necessary imports (context and metav1)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
illume
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.
Thanks!
The GitHub check is failing on a lint issue. You can run lint locally...
npm run backend:lint
npm run backend:format
npm run backend:test
Please consider the open review comment?
fccf03f to
fe0443a
Compare
|
@illume The lint error was from |
|
Thanks for that. Did you look at the coverage report? |
illume
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.
Can you please squash your commits?
1ac1f6b to
ebb1adc
Compare
|
Done! |
|
Thanks for that. Just wondering if you could confirm that this is covering the code paths as you expected by looking at the test coverage report? Some nits on the git commit message for the future (feel free to ignore for this PR)
|
|
Is the current test coverage okay, or should I add more tests to increase coverage further? |
|
Seems pretty good. If you look at the html view you can see which code paths are not covered by tests. |
ebb1adc to
0879f1b
Compare
0879f1b to
9d5899c
Compare

Summary
This PR expands backend test coverage for the experimental
k8cacheby validating cache invalidation on Add, Update, and Delete informer events. Previously, tests exercised only Add events; this change ensures Update/Delete handlers are also covered and behave correctly.Related Issue
Fixes the review feedback on backend cache invalidation tests from PR
Fixes #4506