Skip to content

fix: log yurt-manager Execute() error before exit - #2504

Closed
shiavm006 wants to merge 1 commit into
openyurtio:masterfrom
shiavm006:fix/yurt-manager-error-logging
Closed

fix: log yurt-manager Execute() error before exit#2504
shiavm006 wants to merge 1 commit into
openyurtio:masterfrom
shiavm006:fix/yurt-manager-error-logging

Conversation

@shiavm006

Copy link
Copy Markdown
Contributor

Description

  • Adds error logging before os.Exit(1) in yurt-manager’s main function.
  • When command.Execute() fails, we now log klog.Errorf("yurt-manager failed: %v", err) before exiting.

How I tested it

  • go test ./cmd/yurt-manager/...

Adds a klog error message prior to os.Exit(1) to improve production debugging.
@shiavm006
shiavm006 requested a review from a team as a code owner January 21, 2026 11:38
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jan 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.08%. Comparing base (ed4eb0a) to head (01457aa).
⚠️ Report is 15 commits behind head on master.

Files with missing lines Patch % Lines
cmd/yurt-manager/yurt-manager.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2504      +/-   ##
==========================================
- Coverage   44.09%   44.08%   -0.01%     
==========================================
  Files         399      399              
  Lines       26554    26555       +1     
==========================================
- Hits        11710    11708       -2     
- Misses      13782    13784       +2     
- Partials     1062     1063       +1     
Flag Coverage Δ
unittests 44.08% <0.00%> (-0.01%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shiavm006

Copy link
Copy Markdown
Contributor Author

the test passed locally tho i dont think so it related to the pr

@zyjhtangtang

Copy link
Copy Markdown
Contributor

@shiavm006 Please pay attention to the inadequate unit test coverage.

@shiavm006

Copy link
Copy Markdown
Contributor Author

@shiavm006 Please pay attention to the inadequate unit test coverage.

Regarding unit test coverage main() function is not unit tested, consistent with other entry points in this codebase (e.g., cmd/yurtadm/yurtadm.go). Testing main() functions that call os.Exit() is challenging as it terminates the process, making traditional unit testing impractical.

@shiavm006

Copy link
Copy Markdown
Contributor Author

I've manually tested the error logging path, and the underlying command execution is already covered by existing tests @zyjhtangtang

@stale

stale Bot commented Apr 28, 2026

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the wontfix label Apr 28, 2026
@stale stale Bot closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants