Skip to content
Snippets Groups Projects
Commit 9cfb1057 authored by Mohammad Torkashvand's avatar Mohammad Torkashvand
Browse files

skip dry_run step in case it is a massive redeploy

parent 7289b9f9
No related branches found
No related tags found
No related merge requests found
Pipeline #94531 failed
......@@ -11,7 +11,7 @@ run. After confirmation by an operator, the configuration is committed to the ma
from orchestrator.forms import SubmitFormPage
from orchestrator.forms.validators import Label
from orchestrator.targets import Target
from orchestrator.workflow import StepList, begin, done, workflow
from orchestrator.workflow import StepList, begin, conditional, done, workflow
from orchestrator.workflows.steps import resync, store_process_subscription, unsync
from orchestrator.workflows.utils import wrap_modify_initial_input_form
from pydantic_forms.types import FormGenerator, UUIDstr
......@@ -28,6 +28,7 @@ def _initial_input_form(subscription_id: UUIDstr) -> FormGenerator:
class RedeployBaseConfigForm(SubmitFormPage):
info_label: Label = f"Redeploy base config on {router.router.router_fqdn}?"
tt_number: TTNumber
is_massive_redeploy: bool = False
user_input = yield RedeployBaseConfigForm
......@@ -45,11 +46,13 @@ def redeploy_base_config() -> StepList:
* Perform a dry run of deployment
* Redeploy base config
"""
is_not_massive_redeploy = conditional(lambda state: not bool(state.get("is_massive_redeploy")))
return (
begin
>> store_process_subscription(Target.MODIFY)
>> unsync
>> lso_interaction(deploy_base_config_dry)
>> is_not_massive_redeploy(lso_interaction(deploy_base_config_dry))
>> lso_interaction(deploy_base_config_real)
>> resync
>> done
......
......@@ -57,7 +57,9 @@ def start_redeploy_workflows(tt_number: TTNumber, selected_routers: list[UUIDstr
for selected_router in selected_routers:
try:
result = requests.post(
workflow_url, json=[{"subscription_id": selected_router}, {"tt_number": tt_number}], timeout=10
workflow_url,
json=[{"subscription_id": selected_router}, {"tt_number": tt_number, "is_massive_redeploy": True}],
timeout=10,
)
result.raise_for_status()
except HTTPError as e:
......
......@@ -10,7 +10,9 @@ from test.workflows import (
@pytest.mark.workflow()
@pytest.mark.parametrize("is_massive_redeploy", [False, True])
def test_redeploy_base_config_success(
is_massive_redeploy,
router_subscription_factory,
faker,
):
......@@ -18,10 +20,12 @@ def test_redeploy_base_config_success(
product_id = str(router_subscription_factory().subscription_id)
# Run workflow
initial_input_data = [{"subscription_id": product_id}, {"tt_number": faker.tt_number()}]
initial_input_data = [
{"subscription_id": product_id},
{"tt_number": faker.tt_number(), "is_massive_redeploy": is_massive_redeploy},
]
result, process_stat, step_log = run_workflow("redeploy_base_config", initial_input_data)
for _ in range(2):
for _ in range(1 if is_massive_redeploy else 2):
result, step_log = assert_lso_interaction_success(result, process_stat, step_log)
assert_complete(result)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment