From 01efa2922cd8cb386028869338389bf349087aec Mon Sep 17 00:00:00 2001 From: Luis Mendes Date: Tue, 17 Mar 2026 18:32:56 +0000 Subject: [PATCH] fix(test): align behave BDD scenarios with updated lifecycle-apply behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated automation_levels.feature to expect "applied" processing state instead of "queued" after completing execute on a full_automation plan, matching the new auto_progress() behavior that drives Apply to terminal state. Updated plan_cli_coverage_boost_steps.py to properly mock the full apply lifecycle (get_plan → apply_plan → start_apply → complete_apply) instead of returning a single plan from apply_plan, matching the updated lifecycle_apply_plan command handler that now drives plans through to the terminal applied state. Refs: #753 --- features/automation_levels.feature | 2 +- .../steps/plan_cli_coverage_boost_steps.py | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/features/automation_levels.feature b/features/automation_levels.feature index eb4bfcfb9..d3e67f59d 100644 --- a/features/automation_levels.feature +++ b/features/automation_levels.feature @@ -46,7 +46,7 @@ Feature: Automation Levels Given I have a plan with automation level "full_automation" in execute phase with processing state When I complete execute on the automated plan Then the automated plan phase should be "apply" - And the automated plan processing state should be "queued" + And the automated plan processing state should be "applied" # Plan-Level Override Tests diff --git a/features/steps/plan_cli_coverage_boost_steps.py b/features/steps/plan_cli_coverage_boost_steps.py index 46551a67e..70423397c 100644 --- a/features/steps/plan_cli_coverage_boost_steps.py +++ b/features/steps/plan_cli_coverage_boost_steps.py @@ -293,13 +293,32 @@ def step_service_has_strategize_plan(context) -> None: @given("the service has a complete execute plan for apply") def step_service_has_execute_plan(context) -> None: - plan = _make_plan( + pre_plan = _make_plan( plan_id=_ULIDS[1], name="local/apply-plan", phase=PlanPhase.EXECUTE, processing_state=ProcessingState.COMPLETE, ) - context.mock_lifecycle_service.apply_plan.return_value = plan + apply_queued_plan = _make_plan( + plan_id=_ULIDS[1], + name="local/apply-plan", + phase=PlanPhase.APPLY, + processing_state=ProcessingState.QUEUED, + ) + applied_plan = _make_plan( + plan_id=_ULIDS[1], + name="local/apply-plan", + phase=PlanPhase.APPLY, + processing_state=ProcessingState.APPLIED, + ) + # lifecycle_apply_plan calls get_plan twice: first to check read_only + # and phase, then again after apply_plan to drive _complete_apply_if_queued. + context.mock_lifecycle_service.get_plan.side_effect = [ + pre_plan, + apply_queued_plan, + ] + context.mock_lifecycle_service.apply_plan.return_value = apply_queued_plan + context.mock_lifecycle_service._complete_apply_if_queued.return_value = applied_plan context._apply_plan_id = _ULIDS[1]