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

Add UT for workstatus.go and taint.go and rule.go #3395

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

realnumber666
Copy link
Contributor

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
Promote UT coverage

Which issue(s) this PR fixes:
Part of #3327

Does this PR introduce a user-facing change?:
NONE

@karmada-bot karmada-bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Apr 11, 2023
@karmada-bot karmada-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 11, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #3395 (4c66528) into master (aab5933) will increase coverage by 2.07%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3395      +/-   ##
==========================================
+ Coverage   51.63%   53.70%   +2.07%     
==========================================
  Files         210      210              
  Lines       18921    19077     +156     
==========================================
+ Hits         9770    10246     +476     
+ Misses       8620     8281     -339     
- Partials      531      550      +19     
Flag Coverage Δ
unittests 53.70% <ø> (+2.07%) ⬆️

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

see 16 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@XiShanYongYe-Chang
Copy link
Member

/assign

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

@@ -357,3 +385,132 @@ func TestGetNoExecuteTaints(t *testing.T) {
})
}
}

func TestGetMinTolerationTime(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.

Some paths may not be tested. Can you add more test items?

image

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

expected := true
expectedTolerations := tolerations
actual, actualTolerations := GetMatchingTolerations(taints, tolerations)
if actual != expected {
Copy link
Member

Choose a reason for hiding this comment

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

Here can simply expected to true.

In addition, can more test items be added to cover the test path?

Signed-off-by: rayywu <rayywu@tencent.com>
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

Ask @RainbowMango to help rerun the test.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 24, 2023
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/approve

@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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 Apr 24, 2023
@karmada-bot karmada-bot merged commit 2ef0194 into karmada-io:master Apr 24, 2023
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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.

5 participants