Cover the Pacemaker helper - #99
Merged
Merged
Conversation
73 unit tests against a recording subprocess fake, the module's only seam. helpers/pacemaker.py goes from 20% to 100% statement and branch coverage, with no cluster. Signed-off-by: Florent Carli <florent.carli@rte-france.com>
insatomcat
force-pushed
the
pacemaker-unit-coverage
branch
from
September 7, 2026 15:45
6dd6fea to
1ed8625
Compare
|
This was referenced Sep 7, 2026
eroussy
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



First of three PRs on the helpers, towards the OpenSSF gold coverage criteria.
helpers/pacemaker.pygoes from 20% to 100% statement and 100% branch coverage, in 73 unit tests, with no cluster.Everything the helper does goes through
subprocess, so that module is the only seam the tests need: a recording fake replaces it insidevm_manager.helpers.pacemaker, and the assertions are on the argument list handed tocrm, which is the helper's whole contract.list2cmdlineis the real one, since it only builds the log lines the tests read back.The fake carries a call budget.
wait_for()pollsshow()until a countdown runs out, so a regression in that countdown would spin forever; without the budget the suite would hang in CI instead of failing.No production code changes. Twelve mutations of the module are all caught in under a second each: the
--forceflag ofdelete, itscleanstep, the--force-stopflag, the*stripping inlist_resources, the weak colocation score, thetarget-roleofadd_vmand its default priority, theis_valid_hostreturn code test, thewait_forcountdown, the empty-command guard ofrun_crm_cmd, the empty-host test infind_resource, and thelstripinshow.