-
Notifications
You must be signed in to change notification settings - Fork 919
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
Improve test coverage for /pkg/controllers/certificate, with a minor optimization #5381
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #5381 +/- ##
==========================================
+ Coverage 30.12% 30.32% +0.19%
==========================================
Files 632 632
Lines 43936 43936
==========================================
+ Hits 13236 13322 +86
+ Misses 29742 29638 -104
- Partials 958 976 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/retest |
@xovoxy: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @xovoxy thanks for your contribution. |
3ea7672
to
b2eea41
Compare
Thanks for your tips ~ |
/assign |
Hi @xovoxy would you like to review the ut tests submitted by others? It's not mandatory, you can do it as you wish, and it's an important contribution to the community. Thank you very much! (I highly encourage you to review each other. My perspective may be subjective, but you can discuss it fully and provide more valuable review comments.) |
Of course, this is also a good experience for me. Thank you for your invitation~ |
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.
Ask @zhzhuang-zju help take a review.
/cc @zhzhuang-zju
{ | ||
name: "secret not found", | ||
cluster: &clusterv1alpha1.Cluster{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "test", | ||
}, | ||
}, | ||
wantErr: true, | ||
}, |
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.
This case is not actually tested.
users: | ||
- name: kind-member1 | ||
user: | ||
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SU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0Qnl6Ri82VUFGTjArSjZ5bUdZa2Y3TzNqempCSmh6a2U1UzRzbHMKWUpZU290cWd1VW5YakpCTVJNZzl0YUpSY1RiSU9oVmNHdDByd2t2NDB6V3JpdEplTTFEYmV0Q3FORm9xcms0bQo1WWszWHVwT01VejRtb0dnUzVDbmdIS0xXckVMRjI5VWFsM1BXRUdRbnZoVEc0N2dtUmk2dVVTUGNreGJnVm4wCithVU5Rei9Yc0tpOXgwUEtQU2xJTzMrMFVaMTdIa3Zlb1ZHOGdXRkR5bU94ckMzcEZHUkNNWTFJM3RVdUtvMTYKVUI5NW1XSFFUNjlBZllyanh3R3J4QzdkNTRKL1Y1NERnSUF6cVhFT2FFK1pKTHVYTFE9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== |
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.
The certificate will expire on August 15 next year, which may cause this use case to fail. Can you provide a certificate with a longer validity period, and add comments to indicate the expiration time?
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.
Is this test case necessary, considering it is effectively covered by func Test_getKubeconfigFromSecret
and func TestCertRotationController_shouldRotateCert
?
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.
oh yes, thinks for you suggestion~ let me handle it
…optimization Signed-off-by: xovoxy <[email protected]>
b2eea41
to
5e66106
Compare
hi @XiShanYongYe-Chang @zhzhuang-zju, I’ve updated the issue mentioned above. Could you please review it again? Thanks~ |
/assign @zhzhuang-zju |
Kindly ping @zhzhuang-zju, can you help take a review again? |
sure |
/lgtm cc @XiShanYongYe-Chang |
/lgtm |
Thanks |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: XiShanYongYe-Chang 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 |
What type of PR is this?
/kind cleanup
/kind failing-test
What this PR does / why we need it:
Add the test for /pkg/controllers/certificate, improve test coverage to 55%;
found some places in
CertRotationController
did not use a unified context, changed it together.Which issue(s) this PR fixes:
Part of ##5235
Special notes for your reviewer:
Does this PR introduce a user-facing change?: