53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
from src.services.telegram_gateway import TelegramMessage
|
||
|
||
|
||
def test_action_required_card_exposes_ai_automation_on_fallback() -> None:
|
||
message = TelegramMessage(
|
||
status_emoji="🚨",
|
||
risk_level="CRITICAL",
|
||
resource_name="node-exporter-110",
|
||
root_cause="AI 分析超時(90s),降級至人工審核",
|
||
suggested_action="待分析",
|
||
estimated_downtime="5-15 min",
|
||
approval_id="test-approval-id",
|
||
incident_id="INC-20260429-TEST01",
|
||
primary_responsibility="INFRA",
|
||
confidence=0.0,
|
||
)
|
||
|
||
body = message.format()
|
||
|
||
assert "AI 自動化鏈路" in body
|
||
assert "rule_fallback" in body
|
||
assert "llm_timeout_manual_gate" in body
|
||
assert "OpenClaw" in body
|
||
assert "NemoTron" in body
|
||
assert "Hermes" in body
|
||
assert "ElephantAlpha" in body
|
||
|
||
|
||
def test_nemotron_card_exposes_same_ai_automation_chain() -> None:
|
||
message = TelegramMessage(
|
||
status_emoji="🚨",
|
||
risk_level="CRITICAL",
|
||
resource_name="awoooi-api",
|
||
root_cause="Pod restart loop",
|
||
suggested_action="restart deployment/awoooi-api",
|
||
estimated_downtime="30s",
|
||
approval_id="test-approval-id",
|
||
incident_id="INC-20260429-TEST02",
|
||
primary_responsibility="INFRA",
|
||
confidence=0.86,
|
||
ai_provider="openclaw_nemo",
|
||
ai_model="llama-3.1-nemotron",
|
||
nemotron_enabled=True,
|
||
playbook_name="restart_deployment",
|
||
)
|
||
|
||
body = message.format_with_nemotron()
|
||
|
||
assert "AI 自動化鏈路" in body
|
||
assert "OpenClaw Nemo" in body
|
||
assert "tool_ready" in body
|
||
assert "restart_deployment" in body
|