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 pkg/controllers/binding/binding_controller.go #3547

Merged
merged 1 commit into from
May 22, 2023
Merged

Add UT for pkg/controllers/binding/binding_controller.go #3547

merged 1 commit into from
May 22, 2023

Conversation

zishen
Copy link
Member

@zishen zishen commented May 16, 2023

Signed-off-by: zishen softwarebtg@163.com

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

Special notes for your reviewer:

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 May 16, 2023
@karmada-bot
Copy link
Collaborator

Welcome @zishen! It looks like this is your first PR to karmada-io/karmada 🎉

@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 16, 2023
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~

tempDyClient := fakedynamic.NewSimpleDynamicClient(gclient.NewSchema())
c := &ResourceBindingController{
Client: fake.NewClientBuilder().WithScheme(gclient.NewSchema()).Build(),
RESTMapper: testing2.RestMapper,
Copy link
Member

Choose a reason for hiding this comment

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

How about constructing the RESTMapper in a public package?

Copy link
Member Author

Choose a reason for hiding this comment

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

How about constructing the RESTMapper in a public package?

Good idea. How about test/helper package? And new file named "manager.go"?

Copy link
Member

Choose a reason for hiding this comment

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

I think it is ok.

Name: "test-rb",
Namespace: "default",
Copy link
Member

Choose a reason for hiding this comment

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

How to construct the namespace and name as input parameters?

Copy link
Member Author

Choose a reason for hiding this comment

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

How to construct the namespace and name as input parameters?
yes, I have make all req strcuct as input parameters. Thanks

InformerManager: genericmanager.NewSingleClusterInformerManager(tempDyClient, 0, nil),
DynamicClient: tempDyClient,
}
if tt.existingRB {
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 use tt.rb != nil to replace, so we can emit the input existingRB param.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here can use tt.rb != nil to replace, so we can emit the input existingRB param.

OK,It is indeed necessary.

@karmada-bot karmada-bot added the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label May 17, 2023
@XiShanYongYe-Chang
Copy link
Member

Hi @zishen, can you help squash your commit into one, and then we can ask @RainbowMango to help approve to run the ci test.

@codecov-commenter
Copy link

Codecov Report

Merging #3547 (912066a) into master (db3a907) will increase coverage by 0.31%.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3547      +/-   ##
==========================================
+ Coverage   52.97%   53.28%   +0.31%     
==========================================
  Files         216      216              
  Lines       20012    20014       +2     
==========================================
+ Hits        10601    10665      +64     
+ Misses       8841     8769      -72     
- Partials      570      580      +10     
Flag Coverage Δ
unittests 53.28% <ø> (+0.31%) ⬆️

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

see 5 files with indirect coverage changes

@karmada-bot karmada-bot removed the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label May 19, 2023
Signed-off-by: zishen <softwarebtg@163.com>
@zishen
Copy link
Member Author

zishen commented May 22, 2023

Hi @zishen, can you help squash your commit into one, and then we can ask @RainbowMango to help approve to run the ci test.

ok. I have done it. @RainbowMango help to approve

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

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 22, 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 May 22, 2023
@karmada-bot karmada-bot merged commit 3151f02 into karmada-io:master May 22, 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/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.

5 participants