-
Notifications
You must be signed in to change notification settings - Fork 889
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
Conversation
Welcome @zishen! It looks like this is your first PR to karmada-io/karmada 🎉 |
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 inputexistingRB
param.
OK,It is indeed necessary.
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 Report
❗ 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
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: zishen <softwarebtg@163.com>
ok. I have done it. @RainbowMango help to approve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[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 |
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