ut:add ut for token.go
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
- There is many functions need kubeconfig to do test(especially in karmadactl pkg), so create one function to generate it.
- add ut for token.go and show how to use the generate function.
Which issue(s) this PR fixes: Part of https://github.com/karmada-io/karmada/issues/2579
Special notes for your reviewer: none
Does this PR introduce a user-facing change?:
none
cc @Poor12 @lonelyCZ @XiShanYongYe-Chang @RainbowMango
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by:
To complete the pull request process, please assign lonelycz after the PR has been reviewed.
You can assign the PR to them by writing /assign @lonelycz in a comment when ready.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Codecov Report
Merging #2682 (a5d71bf) into master (be0462c) will increase coverage by
0.96%. The diff coverage isn/a.
:exclamation: Current head a5d71bf differs from pull request most recent head 993aa9c. Consider uploading reports for the commit 993aa9c to get more accurate results
@@ Coverage Diff @@
## master #2682 +/- ##
==========================================
+ Coverage 27.48% 28.44% +0.96%
==========================================
Files 190 190
Lines 19061 19061
==========================================
+ Hits 5239 5422 +183
+ Misses 13461 13262 -199
- Partials 361 377 +16
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 28.44% <ø> (+0.96%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| pkg/search/proxy/store/util.go | 94.15% <0.00%> (+0.58%) |
:arrow_up: |
| pkg/karmadactl/token.go | 76.15% <0.00%> (+76.15%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
/assign @XiShanYongYe-Chang
cc @lonelyCZ
Thanks @jwcesign , I consider that the code of karmadactl will have a big change, so let's back this pr after #2664
Hi @jwcesign , we can push this forward now. :)
cc @lonelyCZ
Thanks @jwcesign , I will look it ASAP.
/assign
It covers most codes.
ok github.com/karmada-io/karmada/pkg/karmadactl/token 0.149s coverage: 76.6% of statements
cc @XiShanYongYe-Chang , do we have the requirement of coverage rate?
It covers most codes.
Looks good!
do we have the requirement of coverage rate?
No, we only have a plan to improve coverage, but we do not have a specific requirement for coverage.
Thanks~
/lgtm /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: lonelyCZ
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~pkg/karmadactl/OWNERS~~ [lonelyCZ]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment