Added tests for controllers/deploymentreplicassyncer
Description: This PR introduces tests for deploymentreplicassyncer controller. The new addition tests significant logic of deploymentreplicassyncer controller.
Additions:
-
TestPredicateFunc:
- Added tests for various scenarios including label changes, replica changes, and different event types (Create, Update, Delete, Generic).
- Ensures the predicate function correctly filters relevant events.
-
TestSetupWithManager:
- Verifies that the controller can be properly set up with a manager.
-
TestReconcile:
- Added test cases for different reconciliation scenarios:
- Binding not found
- Non-divided scheduling type
- Replicas already synced
- Checks for correct result, error handling, and replica updates.
- Added test cases for different reconciliation scenarios:
-
TestIsDeploymentStatusCollected:
- Covers various scenarios:
- Fully collected status
- Mismatched replicas
- Generation mismatches
- Incomplete aggregated status
- Invalid JSON in status
- Zero replicas in status
- Mismatched status replicas
- Covers various scenarios:
Test Coverage: The test coverage of the deploymentreplicassyncer controller has been increased to 63.9% .
What type of PR is this? /kind failing-test /kind feature
Which issue(s) this PR fixes: Fixes a part of #5470
Does this PR introduce a user-facing change?:
NONE
The TestSetupWithManager is removed in the latest commit because it was causing CI failures and provided limited value in terms of testing the controller's core functionality.
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 45.00%. Comparing base (
32c2ef7) to head (455cb39). Report is 378 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## master #5493 +/- ##
===========================================
+ Coverage 31.70% 45.00% +13.29%
===========================================
Files 643 658 +15
Lines 44445 53917 +9472
===========================================
+ Hits 14090 24263 +10173
+ Misses 29325 28080 -1245
- Partials 1030 1574 +544
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 45.00% <ø> (+13.29%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@XiShanYongYe-Chang Please take a look.
/assign
@zhzhuang-zju PTAL
/lgtm thanks cc @XiShanYongYe-Chang
Thanks~ /assign
/lgtm
[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
- ~~pkg/controllers/OWNERS~~ [XiShanYongYe-Chang]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment