Skip to content
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

Added tests for controllers/deploymentreplicassyncer #5493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anujagrawal699
Copy link
Contributor

@anujagrawal699 anujagrawal699 commented Sep 7, 2024

Description:
This PR introduces tests for deploymentreplicassyncer controller. The new addition tests significant logic of deploymentreplicassyncer controller.

Additions:

  1. 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.
  2. TestSetupWithManager:

    • Verifies that the controller can be properly set up with a manager.
  3. 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.
  4. 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

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

@karmada-bot karmada-bot added the kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. label Sep 7, 2024
@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 7, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chaunceyjiang for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 7, 2024
@anujagrawal699 anujagrawal699 force-pushed the addedTests-pkg/controllers/deploymentreplicassyncer branch from 8c04229 to 1a16c6b Compare September 8, 2024 05:52
@karmada-bot karmada-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 8, 2024
@anujagrawal699
Copy link
Contributor Author

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.

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 31.81%. Comparing base (32c2ef7) to head (9f02242).
Report is 64 commits behind head on master.

❗ 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%   31.81%   +0.11%     
==========================================
  Files         643      643              
  Lines       44445    44445              
==========================================
+ Hits        14090    14142      +52     
+ Misses      29325    29270      -55     
- Partials     1030     1033       +3     
Flag Coverage Δ
unittests 31.81% <ø> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Anuj Agrawal <[email protected]>

Added tests for controllers/deploymentreplicassyncer

Signed-off-by: Anuj Agrawal <[email protected]>

Added tests for controllers/deploymentreplicassyncer

Signed-off-by: Anuj Agrawal <[email protected]>
@anujagrawal699 anujagrawal699 force-pushed the addedTests-pkg/controllers/deploymentreplicassyncer branch from 1a16c6b to 9f02242 Compare September 9, 2024 10:44
@anujagrawal699
Copy link
Contributor Author

@XiShanYongYe-Chang Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants