Repository navigation
test(cli): cover execute_plan early stop on failure/reboot (#602) - #611
vladimirrott merged 4 commits into
Conversation
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at 01736334. Approving.
You extended mock_execution_daemon with a per-action status map and left run() as a thin wrapper, so the existing tests that call run() did not change and the new test drives the real execute_plan loop. That was the gap in #602: the earlier tests each wrote their own loop. Asserting the full event sequence, and the step name in the error, pins down both halves of the contract.
What I ran, in a --network=none rust:1-slim container:
filter: execute_plan_halts_after_failed_or_rebooting_second_step
mutation: s/^ exec_result?;$/ let _ = exec_result;/
unmutated: 1 executed unit, passing
mutated: test runner::tests::plan_preflight_tests::execute_plan_halts_after_failed_or_rebooting_second_step ... FAILED (rc=101)
Also checked:
cargo fmt --all -- --checkon the PR tree: rc=0.- Test count:
runner.rshas 101 test attributes onmainand 102 here. The diff adds one#[tokio::test]and removes none, so 1,991 is right in the JSON and in all three docs. - CI: 12 pass,
container-smokeskipped.
Nothing blocking and nothing optional. Test-only, so no CHANGELOG line.
If you want the next one, #561 sits beside this code: --dry-run exits 0 for a plan the real run would refuse, because the dry-run path returns before the --max-risk ceiling and the distro check. It is in the pool now. Say so on #561 and I'll hold it for you.
test(cli): guard execute_plan against failed/rebooting steps (#602)
Closes #602.
Thanks to @vladimirrott for catching this gap.
The existing daemon-double tests checked the step verdict, but none exercised the error propagation in the actual
execute_planloop.This PR extends the existing mock daemon to return a chosen status per action, then runs a real three-step
execute_planfor both failure cases:failedon the second step: exit code 2.needs_rebooton the second step: exit code 5.Verification on Linux (
rust:1-slim):cargo fmt --all -- --check— pass.cargo test -p sysknife-cli --bins --offline— 321 passed; 0 failed.exec_result?;withlet _ = exec_result;. The new test fails as expected, because the third action executes and the plan returns success:This is test-only; no production changes.