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 in pkg/binding for condition coverage #5388

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

yashpandey06
Copy link

What type of PR is this?

/kind feature

What this PR does / why we need it:
This PR adds comprehensive unit tests for the following functions in the binding package:

Changes Made

  1. Added Unit Tests for needReviseReplicas:

    • Covered various scenarios including:
      • Replicas is zero.
      • Placement is nil.
      • Replica scheduling type is not divided.
      • Replica scheduling type is divided.
  2. Added Unit Tests for divideReplicasByJobCompletions:

    • Covered various scenarios including:
      • Completions found.
      • Completions not found.
      • Error in NestedInt64.

Testing

  • Ran all unit tests to ensure they pass.
  • Verified that the new tests cover the intended scenarios and edge cases.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 16, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 16, 2024
@yashpandey06
Copy link
Author

@XiShanYongYe-Chang please help review this PR

@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 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 29.83%. Comparing base (bcefb22) to head (7bef098).
Report is 33 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    #5388      +/-   ##
==========================================
+ Coverage   29.41%   29.83%   +0.42%     
==========================================
  Files         632      632              
  Lines       43835    43936     +101     
==========================================
+ Hits        12892    13109     +217     
+ Misses      30003    29868     -135     
- Partials      940      959      +19     
Flag Coverage Δ
unittests 29.83% <ø> (+0.42%) ⬆️

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.

@XiShanYongYe-Chang
Copy link
Member

XiShanYongYe-Chang commented Aug 17, 2024

Ok, thanks @yashpandey06
/assign

By the way, would you like to review the ut tests submitted by others? It's not mandatory, you can do it as you wish, and it's an important contribution to the community. Thank you very much! (I highly encourage you to review each other. My perspective may be subjective, but you can discuss it fully and provide more valuable review comments.)

@yashpandey06
Copy link
Author

Ok, thanks @yashpandey06
/assign

By the way, would you like to review the ut tests submitted by others? It's not mandatory, you can do it as you wish, and it's an important contribution to the community. Thank you very much! (I highly encourage you to review each other. My perspective may be subjective, but you can discuss it fully and provide more valuable review comments.)

@XiShanYongYe-Chang , sure I would like to review uts submitted by other , that would be fun and great learning as well 😁

@anujagrawal699
Copy link
Contributor

@yashpandey06 You can also review my PR's : #5366. Thanks!

@anujagrawal699
Copy link
Contributor

@yashpandey06 Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

@yashpandey06
Copy link
Author

@yashpandey06 Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

Thanks man ! For the review , but my wasn't the coverage of 100 % , making sure the repos atleast the average safety coverage of 40 to 50 %. And coming to to checking the report i already made a report based on it .

@yashpandey06
Copy link
Author

@yashpandey06 Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

Thanks man ! For the review , but my wasn't the coverage of 100 % ( LFX Mentorship serves this purpose specifically ) , making sure the repos atleast the average safety coverage of 40 to 50 %. And coming to to checking the report i already made a report based on it .

@yashpandey06
Copy link
Author

@yashpandey06 You can also review my PR's : #5366. Thanks!

Yup ! , currently I am away from my home town so doesn't have acces to my setup , but I ll be reaching there by tomorrow, so would be reviewing many prs for sure 😁.

@XiShanYongYe-Chang
Copy link
Member

Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

That's okay. If some files are large and difficult to improve overall, and only some of the functions in the file are improved at a time, you can state which methods are improved in the PR description.

@yashpandey06
Copy link
Author

Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

That's okay. If some files are large and difficult to improve overall, and only some of the functions in the file are improved at a time, you can state which methods are improved in the PR description.

Already did so ...thanks for the information 🙂

@anujagrawal699
Copy link
Contributor

@yashpandey06 Try to add more tests, it only improved the test of coverage of binding controller by 1%. You can verify it in the file directory using go test -coverprofile=coverage.out.

Thanks man ! For the review , but my wasn't the coverage of 100 % , making sure the repos atleast the average safety coverage of 40 to 50 %. And coming to to checking the report i already made a report based on it .

Okay, thanks for the PR. /lgtm

@yashpandey06
Copy link
Author

@XiShanYongYe-Chang, here are the required changes

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.

Thanks~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 22, 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 Aug 22, 2024
@karmada-bot karmada-bot merged commit dc1669d into karmada-io:master Aug 22, 2024
12 checks passed
@RainbowMango RainbowMango added this to the v1.11 milestone Aug 31, 2024
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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. 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.

[lfx-mentorship-2024-September-November] Enhance Karmada controller-manager and schedule testing coverage
6 participants