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 federatedhpa controller #5528

Conversation

anujagrawal699
Copy link
Contributor

Description:
This PR introduces the first set of comprehensive unit tests for the Federated Horizontal Pod Autoscaler (FederatedHPA) controller and its associated components. Due to the extensive nature of the test additions, i'll try to split the test additions into 2 PR's.

Additions:

  1. FederatedHPA Controller (pkg/controllers/federatedhpa/federatedhpa_controller_test.go)
  2. Metrics Client (pkg/controllers/federatedhpa/metrics/client_test.go)
  3. Replica Calculator (pkg/controllers/federatedhpa/replica_calculator_test.go)
  4. Config Types (pkg/controllers/federatedhpa/config/types_test.go)

Test Coverage Improvements:
federatedhpa_controller_test.go: 0% to 41.2% (More tests will be added in the future PR)
client_test.go: 0% to 92.9%
replica_calculator_test.go: 0% to 85.7%
types_test.go: 0% t 100%

What type of PR is this?
/kind documentation
/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/documentation Categorizes issue or PR as related to documentation. label Sep 11, 2024
@karmada-bot karmada-bot added 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 11, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 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 33.70%. Comparing base (4ac95b9) to head (337f787).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5528      +/-   ##
==========================================
+ Coverage   32.45%   33.70%   +1.25%     
==========================================
  Files         643      643              
  Lines       44497    44497              
==========================================
+ Hits        14440    14999     +559     
+ Misses      28962    28355     -607     
- Partials     1095     1143      +48     
Flag Coverage Δ
unittests 33.70% <ø> (+1.25%) ⬆️

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 federatedhpa controller

Signed-off-by: Anuj Agrawal <[email protected]>
@anujagrawal699
Copy link
Contributor Author

@XiShanYongYe-Chang Could you please trigger a retest?

@XiShanYongYe-Chang
Copy link
Member

You can enter this amount command
/retest

Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 12, 2024
@karmada-bot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 12, 2024
@XiShanYongYe-Chang
Copy link
Member

/remove-kind documentation

@karmada-bot karmada-bot removed the kind/documentation Categorizes issue or PR as related to documentation. label Sep 12, 2024
@karmada-bot karmada-bot merged commit 671372a into karmada-io:master Sep 12, 2024
12 checks passed
@anujagrawal699
Copy link
Contributor Author

@XiShanYongYe-Chang Do a test file for pkg/controllers/federatedhpa/monitor/metrics.go and pkg/controllers/federatedhpa/monitor/monitor.go needed?

@XiShanYongYe-Chang
Copy link
Member

You can try it. I'll see how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants