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 cmd/scheduler #5459

Merged

Conversation

anujagrawal699
Copy link
Contributor

@anujagrawal699 anujagrawal699 commented Aug 29, 2024

Description:
This PR introduces tests for cmd/scheduler/app/scheduler.go and cmd/scheduler/app/options/options.go .

What type of PR is this?
/kind failing-test
/kind feature

What this PR does / why we need it:
This PR adds comprehensive tests for testing core functionality of cmd/scheduler .

Which issue(s) this PR fixes:
Fixes a part of #5236

Special notes for your reviewer:
The additions in this PR are similar to implemented in #5445 .

Does this PR introduce a user-facing change?:

NONE

@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. labels Aug 29, 2024
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 29, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 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.72%. Comparing base (2efe03f) to head (b64a76c).
Report is 36 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    #5459      +/-   ##
==========================================
+ Coverage   31.14%   31.72%   +0.58%     
==========================================
  Files         640      643       +3     
  Lines       44417    44432      +15     
==========================================
+ Hits        13832    14097     +265     
+ Misses      29583    29306     -277     
- Partials     1002     1029      +27     
Flag Coverage Δ
unittests 31.72% <ø> (+0.58%) ⬆️

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.

@anujagrawal699
Copy link
Contributor Author

@XiShanYongYe-Chang I implemented tests for options.go in this PR. If this is valid, then i could add something similar for cmd/descheduler/app/options/options.go. I'll squash the commits if it is valid or i'll drop it.

@anujagrawal699
Copy link
Contributor Author

@XiShanYongYe-Chang I implemented tests for options.go in this PR. If this is valid, then i could add something similar for cmd/descheduler/app/options/options.go. I'll squash the commits if it is valid or i'll drop it.

@XiShanYongYe-Chang I didn't got what you meant by eyes emoji?

"github.com/stretchr/testify/assert"
)

func TestNewOptions(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

This test may be meaningless.

Copy link
Contributor Author

@anujagrawal699 anujagrawal699 Aug 30, 2024

Choose a reason for hiding this comment

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

I could add it in TestAddFlags or remove it. But It can serve as a form of documentation stating the expected default values and it can catch unintended changes to default values in future code modifications.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ok, can you help squash the commits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, can you help squash the commits?

DONE.

@XiShanYongYe-Chang
Copy link
Member

I didn't got what you meant by eyes emoji?

What I'm trying to say is that I'm reviewing. Maybe it's not enough, but there's a little bit less to choose from.

@anujagrawal699
Copy link
Contributor Author

I didn't got what you meant by eyes emoji?

What I'm trying to say is that I'm reviewing. Maybe it's not enough, but there's a little bit less to choose from.

Okay, i'll make the changes once you complete review.

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

Added tests for cmd/scheduler

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

@XiShanYongYe-Chang I created a similar test file for cmd/descheduler/app/options/options.go . Should i make a push it?

@XiShanYongYe-Chang
Copy link
Member

Let's wait until this pr is integrated.

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.

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 2, 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 2, 2024
@karmada-bot karmada-bot merged commit 9351b76 into karmada-io:master Sep 2, 2024
12 checks passed
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/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.

4 participants