Skip to content

Conversation

@ncode
Copy link
Owner

@ncode ncode commented Sep 5, 2025

This pull request adds comprehensive unit tests for the main command modules of the project, focusing on validating flag parsing, error handling, help output, and configuration loading for the CLI commands. The new tests cover the run, cleanup, and root command behaviors, as well as the systemd template rendering logic, improving the reliability and maintainability of the CLI tool.

Command testing improvements

  • Added cmd/run_test.go with tests for the run command, covering required flag validation, flag parsing, and help output scenarios.
  • Added cmd/cleanup_test.go with tests for the cleanup command, including flag requirements, flag parsing, and help output verification.
  • Added cmd/root_test.go with tests for the root command, verifying help output, unknown subcommand handling, persistent flag definitions, and configuration loading from a file.

Systemd template validation

  • Added a test to pkg/systemd/systemd_test.go to verify that the global parsedTemplate is initialized and renders expected systemd sections with valid input data.

@codecov
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.26%. Comparing base (f17a016) to head (1734d39).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   65.54%   66.26%   +0.72%     
==========================================
  Files           7        7              
  Lines         415      415              
==========================================
+ Hits          272      275       +3     
+ Misses        136      134       -2     
+ Partials        7        6       -1     

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

@ncode ncode merged commit afd6207 into main Sep 6, 2025
5 checks passed
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.

1 participant