Align sized cluster seeds and GET dumps with PVE wire shapes; restyle DATA panel.
- Scale small/large/big seeds (3×50 / 10×1000 / 20×2000) with proportional backups, snapshots, HA, replication, Ceph capacity, and OSD totals (10 / 100 / 500) plus matching node disks and crush/pg metadata - Enrich handler responses for apt, certificates, qemu/lxc status, storage, SDN, metrics export, and related cluster/node dumps - Flatten nested body_example fields into PARAMS and sync the request body via dotted paths (oVirt-style) - Restyle DATA controls as size cards with full-width Reset to minimal / Refresh stats; unload reloads the minimal cluster
This commit is contained in:
@@ -39,20 +39,33 @@ class FakePool:
|
||||
|
||||
async def fetch(self, sql: str, *args: object) -> list[dict[str, object]]:
|
||||
del args
|
||||
if "FROM pool_members" in sql or "kind='ha'" in sql:
|
||||
return []
|
||||
if "FROM nodes" in sql:
|
||||
return [{"node": "pve1", "status": "online"}]
|
||||
return [{"node": "pve1", "name": "pve1", "status": "online"}]
|
||||
if "r.kind='qemu'" in sql:
|
||||
return [{"vmid": 100, "state": '{"name":"demo","status":"stopped"}'}]
|
||||
return [
|
||||
{
|
||||
"type": "qemu",
|
||||
"external_id": "100",
|
||||
"state": '{"status":"stopped"}',
|
||||
"node": "pve1",
|
||||
}
|
||||
]
|
||||
return [
|
||||
{
|
||||
"vmid": 100,
|
||||
"state": '{"name":"demo","status":"stopped"}',
|
||||
"config": '{"name":"demo","memory":2048,"cores":2}',
|
||||
}
|
||||
]
|
||||
if "r.kind = ANY" in sql or "r.kind AS type" in sql:
|
||||
return [
|
||||
{
|
||||
"type": "qemu",
|
||||
"external_id": "100",
|
||||
"state": '{"status":"stopped","name":"demo"}',
|
||||
"node": "pve1",
|
||||
}
|
||||
]
|
||||
return []
|
||||
|
||||
async def fetchval(self, sql: str) -> int:
|
||||
async def fetchval(self, sql: str, *args: object) -> object:
|
||||
del args
|
||||
if "SELECT name FROM clusters" in sql:
|
||||
return "pve-simulator"
|
||||
return 100 if "pg_backend_pid" in sql else 1_700_000_000
|
||||
|
||||
|
||||
@@ -194,10 +207,13 @@ async def test_core_login_and_read_endpoints(
|
||||
assert login.status_code == 200
|
||||
assert login.json()["data"]["username"] == "root@pam"
|
||||
assert "ticket" in login.json()["data"]
|
||||
assert login.json()["data"]["clustername"] == "pve-simulator"
|
||||
assert version.json()["data"]["version"] == "test"
|
||||
assert version.json()["data"]["release"] == "test"
|
||||
assert nodes.json()["data"][0]["node"] == "pve1"
|
||||
assert status.json()["data"]["status"] == "online"
|
||||
assert "uptime" in status.json()["data"]
|
||||
assert "memory" in status.json()["data"]
|
||||
assert "cpuinfo" in status.json()["data"]
|
||||
resource_types = {item["type"] for item in resources.json()["data"]}
|
||||
assert "qemu" in resource_types
|
||||
qemu_resources = [item for item in resources.json()["data"] if item["type"] == "qemu"]
|
||||
|
||||
Reference in New Issue
Block a user