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 "k3s certificate check" clause for better test coverage #11485

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dereknola
Copy link
Member

@dereknola dereknola commented Dec 19, 2024

Proposed Changes

  • Adds coverage of the k3s certificate check CLI in testing.
  • Adds "--output table" format for cert check
derek@degion:~/rancher/k3s$ sudo ./dist/artifacts/k3s certificate check -o table
INFO[0000] Acquiring lock file /var/lib/rancher/k3s/data/.lock 
INFO[0000] Preparing data dir /var/lib/rancher/k3s/data/028414f76580c17e66747d4743a4ad51a705efcdc49cb61e619bdfb975acdb01 
INFO[0000] Server detected, checking agent and server certificates 

CERTIFICATE                      SUBJECT                                    STATUS  EXPIRES
-----------                      -------                                    ------  -------
client-admin.crt                 CN=system:admin,O=system:masters           OK      2025-12-20T19:55:36Z
client-admin.crt                 CN=k3s-client-ca@1734724536                OK      2034-12-18T19:55:36Z
client-kube-proxy.crt            CN=system:kube-proxy                       OK      2025-12-20T19:55:36Z
client-kube-proxy.crt            CN=k3s-client-ca@1734724536                OK      2034-12-18T19:55:36Z

Types of Changes

Testing

Verification

Coverage report

github.com/k3s-io/k3s/pkg/cli/cert/cert.go:52:			Check			66.7%

Testing

Linked Issues

#11484

User-Facing Change

Can now get a table output for `k3s certificate check` using `--output table` flag

Further Comments

@dereknola dereknola requested a review from a team as a code owner December 19, 2024 19:56
brandond
brandond previously approved these changes Dec 19, 2024
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 32.69231% with 35 lines in your changes missing coverage. Please review.

Project coverage is 38.85%. Comparing base (bb32254) to head (467498f).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/cli/cert/cert.go 25.53% 31 Missing and 4 partials ⚠️

❗ There is a different number of reports uploaded between BASE (bb32254) and HEAD (467498f). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (bb32254) HEAD (467498f)
unittests 2 0
e2etests 7 6
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11485      +/-   ##
==========================================
- Coverage   47.87%   38.85%   -9.03%     
==========================================
  Files         181      164      -17     
  Lines       18794    18238     -556     
==========================================
- Hits         8998     7086    -1912     
- Misses       8448     9948    +1500     
+ Partials     1348     1204     -144     
Flag Coverage Δ
e2etests 35.23% <9.61%> (-7.81%) ⬇️
inttests 18.88% <32.69%> (-15.97%) ⬇️
unittests ?

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

ohh a tabwriter, fancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants