Commit Graph

13 Commits

Author SHA1 Message Date
adf3c36632 fix(helpers): return ErrValueNotSet for nonexistent units in GetNumRestarts (#9)
systemd returns NRestarts=0 for units with LoadState=not-found, making
it indistinguishable from a genuinely loaded unit with zero restarts.
GetNumRestarts now checks LoadState when NRestarts is 0 and returns
ErrValueNotSet for units that don't exist, matching GetMemoryUsage
behavior.

Also adds unit tests for filterErr (all stderr error mapping cases)
and HasValidUnitSuffix (all valid unit types + negative cases).

Updates syncthing test expectation from ErrValueNotSet to nil since
loaded-but-inactive units legitimately have NRestarts=0.
2026-03-05 12:26:12 -05:00
fa15432121 add ability to list all units 2024-08-08 15:37:04 -07:00
0075dc6b4d update to fix some tests, remove panics, and wrap errors 2023-06-17 23:18:28 -04:00
5da4924315 gofumpt against remaining go files 2022-10-23 23:28:19 -07:00
125e4771dd cleans up comments, adds short testing options to more tests 2021-05-16 23:19:59 -07:00
27c2ad77c8 improves IsActive testing 2021-05-16 22:32:24 -07:00
e941c90f0d Migrates many tests to errors_test 2021-05-16 22:00:50 -07:00
dd48d610dc Adds helper function for getting NRestarts 2021-05-16 19:41:44 -07:00
3fcd88d966 Clean up errors and messages 2021-05-16 16:17:12 -07:00
7325dda66d Export UserMode options 2021-05-16 15:53:54 -07:00
34f11bfcd1 Add masked unit tests for enable and disable 2021-05-15 20:02:05 -07:00
b1346b7992 Finish tests for helper methods 2021-05-15 19:07:47 -07:00
64249bf8e6 Adds more tests for GetStartTime 2021-05-15 18:14:01 -07:00