Self-hosted, Docker-based agentic troubleshooting platform: FastAPI backend + LangGraph agent, Next.js UI, tiered LLM routing (local Ollama -> Gemini -> DeepSeek -> OpenRouter), MCP server manager, encrypted device credentials, RBAC, audit log, project-memory + Obsidian integrations, and editable troubleshooting decision rules tuned for the GeneseasX vessel stack. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
"""Tests for Proxmox profile helpers."""
|
|
from app.agent.proxmox_profiles import (
|
|
_api_guest_inventory_empty,
|
|
_first_proxmox_node,
|
|
_parse_qemu_vms,
|
|
wants_vm_inventory,
|
|
)
|
|
|
|
|
|
def test_first_proxmox_node_from_json_list():
|
|
out = '[{"node":"genx","status":"online"}]'
|
|
assert _first_proxmox_node(out) == "genx"
|
|
|
|
|
|
def test_first_proxmox_node_from_regex():
|
|
out = 'nodes: {"node":"pve1"}'
|
|
assert _first_proxmox_node(out) == "pve1"
|
|
|
|
|
|
def test_wants_vm_inventory_from_task4_issue():
|
|
assert wants_vm_inventory(
|
|
"Proxmox VM status",
|
|
"Check status of all running VMs and provide config for each VM",
|
|
)
|
|
|
|
|
|
def test_parse_qemu_vms_json():
|
|
out = '[{"vmid":100,"name":"pfsense","status":"running","cpus":2}]'
|
|
vms = _parse_qemu_vms(out)
|
|
assert len(vms) == 1
|
|
assert vms[0]["vmid"] == 100
|
|
|
|
|
|
def test_parse_qemu_vms_qm_list_text():
|
|
out = """ VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
|
|
100 pfsense running 4096 32.00 1234
|
|
101 debian-docker running 8192 64.00 5678"""
|
|
vms = _parse_qemu_vms(out)
|
|
assert len(vms) == 2
|
|
assert vms[0]["vmid"] == 100
|
|
assert vms[0]["status"] == "running"
|
|
|
|
|
|
def test_api_guest_inventory_empty():
|
|
results = [
|
|
{"tool": "proxmox_list_qemu", "output": "[]"},
|
|
{"tool": "proxmox_list_lxc", "output": "[]"},
|
|
]
|
|
assert _api_guest_inventory_empty(results)
|
|
|
|
|
|
def test_api_guest_inventory_not_empty_when_qemu_has_rows():
|
|
results = [
|
|
{"tool": "proxmox_list_qemu", "output": '[{"vmid":100,"name":"pfsense","status":"running"}]'},
|
|
{"tool": "proxmox_list_lxc", "output": "[]"},
|
|
]
|
|
assert not _api_guest_inventory_empty(results)
|