Repository navigation
test(packit): executed coverage for package_chunks and the packit_workflow CLI - #200
Conversation
… CLI package_chunks() and main() had zero coverage: tests/test_packit_workflow.py exercised only package_names() and result(), leaving tools/packit_workflow.py at 46%. The uncovered half is what packit-srpm-pilot.yml depends on. package_chunks exists because GitHub expands a matrix larger than 256 jobs to zero jobs without failing, so a regression there is a green run that builds nothing. Adds assertions that the default chunk size stays under the 256-job cap, that splitting is lossless and order-preserving, that an empty package list yields an empty matrix rather than an empty job, that a non-positive size is refused, and that the packages/chunks/result subcommands print the JSON shapes the workflow consumes - including the non-zero exits for an invalid --status and a missing subcommand. tools/packit_workflow.py coverage: 46% -> 100%. Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
castrojo
left a comment
There was a problem hiding this comment.
Reviewed: Adds thorough test coverage for package_chunks and the packit_workflow CLI in tests/test_packit_workflow.py. Clean trial merge and passes all tests. Carries maintainer 'hold' label; awaiting maintainer removal of hold and second independent review to satisfy merge policy.
castrojo
left a comment
There was a problem hiding this comment.
Reviewed: Adds thorough test coverage for package_chunks and the packit_workflow CLI in tests/test_packit_workflow.py. Clean trial merge and passes all tests. Carries maintainer 'hold' label; awaiting maintainer removal of hold and second independent review to satisfy merge policy.
|
Reviewed: Adds thorough test coverage for |
castrojo
left a comment
There was a problem hiding this comment.
Reviewed: Adds thorough test coverage for package_chunks and the packit_workflow CLI in tests/test_packit_workflow.py. Clean trial merge and passes all tests. Carries maintainer 'hold' label; awaiting maintainer removal of hold and second independent review to satisfy merge policy.
Danathar
left a comment
There was a problem hiding this comment.
Reviewed at ff592a6. The only change is tests/test_packit_workflow.py; tools/packit_workflow.py is untouched. The new cases call package_chunks() and main() directly (argv patched, stdout captured, the main path via runpy), and pytest --cov shows 97% of the module executed, the missing line being the if name guard itself. Mutation check on my side: MATRIX_CHUNK = 300 fails one test, an off-by-one in the chunk range (size + 1) fails one test, and changing the --nevra default fails one test, so the cap, the lossless split and the CLI defaults are genuinely asserted. Full suite passes at this head (411 passed) and after a trial merge of current main (426 passed); validate.py, factory_contract.py, runtime_contract.py --check and check_workflow_quoting.py pass. The PR still carries the hive hold label, which needs a maintainer to remove.
hanthor
left a comment
There was a problem hiding this comment.
Test-only change to tests/test_packit_workflow.py. It merges cleanly into main and the 17 tests pass there. The red and cancelled checks are stale factory-build runs on the old head, which a test file can't affect. The hold label still needs removing before this merges.
Test Improvement
Fresh, rebased replacement for #152, which @hanthor closed with: "Closing to
consolidate the queue on the merged #178 full-factory candidate. The branch is
retained; please re-open or submit a fresh, rebased PR after that build
establishes the current baseline." This branch is cut from current
main(post-#178); the retained
quality/test-packit-workflow-chunksbranch is leftuntouched.
Claimed ground:
tests/test_packit_workflow.pyonly — coveringtools/packit_workflow.pypackage_chunks()andmain(). No production codeis changed. This is disjoint from #192 (
tools/rebuild_matrix.py,tests/test_rebuild_matrix.py) and from #194 (architecture inventory counts).package_chunks()andmain()had zero coverage — the existing suiteexercised only
package_names()andresult().package_chunksis the guard against GitHub expanding a matrix larger than256 jobs to zero jobs without failing, which is what
.github/workflows/packit-srpm-pilot.ymlfeeds intomatrix.chunkviafromJson. A regression there is not a red run — it is a green run that builtnothing.
Added:
package_chunks(..., size=0)and a negative size raiseValueErrorpackages/chunks/resultsubcommands print the JSON shapes the workflow consumes, driven as CI drives them, including--nevradefaulting--statusand a missing subcommand exit non-zero__main__entrypoint propagates the exit codeEvidence
Before:
After:
Full suite (
python3 -m pytest tests -q, the commandvalidate.yml:32runs):396 passed before, 411 passed after — no existing test changed.
Mutation check: raising
MATRIX_CHUNKto 300 failstest_default_chunk_size_stays_under_the_github_matrix_capandtest_a_list_above_the_cap_is_split_and_no_chunk_exceeds_it, so the cap guardis genuinely asserted rather than restated.
Related Issue
Closes #151
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78