Skip to content

Comments

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

Open
shiavm006 wants to merge 1 commit intoopenyurtio:masterfrom
shiavm006:fix/yurt-manager-error-logging
Open

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

Conversation

@shiavm006
Copy link
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

@codecov
Copy link

codecov bot commented Jan 21, 2026

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

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
Contributor Author

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

@zyjhtangtang
Copy link

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

@shiavm006
Copy link
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
Contributor Author

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

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