karmada icon indicating copy to clipboard operation
karmada copied to clipboard

ut:add ut for token.go

Open jwcesign opened this issue 3 years ago • 6 comments

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

jwcesign avatar Oct 25 '22 07:10 jwcesign

cc @Poor12 @lonelyCZ @XiShanYongYe-Chang @RainbowMango

jwcesign avatar Oct 25 '22 07:10 jwcesign

[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.

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 avatar Oct 25 '22 07:10 karmada-bot

Codecov Report

Merging #2682 (a5d71bf) into master (be0462c) will increase coverage by 0.96%. The diff coverage is n/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.

codecov-commenter avatar Oct 25 '22 08:10 codecov-commenter

/assign @XiShanYongYe-Chang

RainbowMango avatar Oct 25 '22 12:10 RainbowMango

cc @lonelyCZ

jwcesign avatar Oct 26 '22 01:10 jwcesign

Thanks @jwcesign , I consider that the code of karmadactl will have a big change, so let's back this pr after #2664

lonelyCZ avatar Oct 28 '22 02:10 lonelyCZ

Hi @jwcesign , we can push this forward now. :)

lonelyCZ avatar Nov 17 '22 02:11 lonelyCZ

cc @lonelyCZ

jwcesign avatar Nov 17 '22 08:11 jwcesign

Thanks @jwcesign , I will look it ASAP.

/assign

lonelyCZ avatar Nov 21 '22 15:11 lonelyCZ

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?

lonelyCZ avatar Nov 27 '22 08:11 lonelyCZ

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.

XiShanYongYe-Chang avatar Nov 28 '22 01:11 XiShanYongYe-Chang

Thanks~

/lgtm /approve

lonelyCZ avatar Nov 28 '22 02:11 lonelyCZ

[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

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 avatar Nov 28 '22 02:11 karmada-bot