mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-05 04:27:55 +00:00
377a483c01
The test added with this fix matched regexes against the text of setupntp and makentp.pm. A source match cannot tell whether the code it found ever runs, and it describes the fix rather than the behaviour: unlike(qr/check_exec_or_exit[^\n]*hwclock/) says "this line does not mention hwclock", where what matters is that a management node without hwclock still gets its clock set. Run the script instead. setupntp cannot simply be executed: it forces its own PATH, so its commands cannot be stubbed from outside, and it exits unless UID is 0, so it cannot run as an ordinary user. The test takes the script's own helper functions and the section that configures the daemon and drives them with shell functions, which bash resolves ahead of PATH and which both `type` and `command -v` report as present -- the two probes the script uses. A node without hwclock is simulated by hiding it from both, rather than by asserting on the shape of the check. Every assertion now fails when the behaviour it describes is removed: hwclock required by check_exec_or_exit again 5 assertions fail the hwclock guard removed 2 assertions fail systemd-timesyncd left running 2 assertions fail systemd-timesyncd left enabled 2 assertions fail The debian/control and xCAT.spec checks are kept as they were. Those are manifest contents, not behaviour -- there is nothing to execute, and the assertion is on a package name that survives reformatting. The match on makentp.pm for xCAT::NTP::Backend->choose is dropped. It asserted that a call site exists; ntp_backend_selection.t already drives the selector itself across 33 assertions, which is the decision that matters. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>