29 lines
864 B
Python
29 lines
864 B
Python
from __future__ import annotations
|
|
|
|
from types import SimpleNamespace
|
|
|
|
from src.api.v1.webhooks import _auto_repair_action_label
|
|
|
|
|
|
def test_auto_repair_action_label_includes_executed_steps() -> None:
|
|
result = SimpleNamespace(
|
|
playbook_id="PB-TEST",
|
|
executed_steps=["kubectl rollout restart deployment/api -n awoooi-prod"],
|
|
)
|
|
|
|
label = _auto_repair_action_label(result, fallback_target="api:awoooi-prod")
|
|
|
|
assert label == (
|
|
"auto_repair_playbook:PB-TEST "
|
|
"kubectl rollout restart deployment/api -n awoooi-prod"
|
|
)
|
|
|
|
|
|
def test_auto_repair_action_label_uses_target_when_steps_missing() -> None:
|
|
result = SimpleNamespace(playbook_id="PB-TEST", executed_steps=[])
|
|
|
|
label = _auto_repair_action_label(result, fallback_target="api:awoooi-prod")
|
|
|
|
assert label == "auto_repair_playbook:PB-TEST api:awoooi-prod"
|
|
|