Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_routes_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ async def test_add_duplicate_by_type_and_url(self, client):
"""
first = await client.post("/api/providers", json={
"name": "rkllama-one", "type": "rkllama",
"url": "http://localhost:8080", "priority": 1,
"url": "http://localhost:18080", "priority": 1,
})
assert first.status_code == 200
second = await client.post("/api/providers", json={
"name": "rkllama-two", "type": "rkllama",
"url": "http://localhost:8080", "priority": 2,
"url": "http://localhost:18080", "priority": 2,
})
assert second.status_code == 409
body = second.json()
Expand Down
45 changes: 26 additions & 19 deletions tests/test_routes_taosmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
import pytest
from unittest.mock import AsyncMock, patch

from tinyagentos.hardware import (
CpuInfo,
DiskInfo,
GpuInfo,
HardwareProfile,
NpuInfo,
OsInfo,
)
from tinyagentos.routes.taosmd import MEMORY_TIERS


Expand Down Expand Up @@ -150,14 +158,13 @@ async def test_setup_progresses_to_done_with_mock_installer(self, client, app):
get=lambda _id: fake_manifest if _id == "nomic-embed-text-v1.5" else None,
mark_installed=lambda *_a, **_kw: None,
)
# Hardware profile shaped to dataclasses.asdict — flat dict.
fake_hw = SimpleNamespace(
fake_hw = HardwareProfile(
ram_mb=4096,
cpu={"arch": "x86_64"},
gpu={"type": "nvidia", "cuda": True, "vram_mb": 12288},
npu={"type": "none"},
disk={"free_gb": 100},
os={"distro": "linux"},
cpu=CpuInfo(arch="x86_64"),
gpu=GpuInfo(type="nvidia", cuda=True, vram_mb=12288),
npu=NpuInfo(type="none"),
disk=DiskInfo(free_gb=100),
os=OsInfo(distro="linux"),
)

mock_installer = AsyncMock()
Expand Down Expand Up @@ -200,13 +207,13 @@ async def test_setup_marks_failed_on_install_error(self, client, app):
get=lambda _id: fake_manifest,
mark_installed=lambda *_a, **_kw: None,
)
fake_hw = SimpleNamespace(
fake_hw = HardwareProfile(
ram_mb=4096,
cpu={"arch": "x86_64"},
gpu={"type": "none"},
npu={"type": "none"},
disk={"free_gb": 100},
os={"distro": "linux"},
cpu=CpuInfo(arch="x86_64"),
gpu=GpuInfo(type="none"),
npu=NpuInfo(type="none"),
disk=DiskInfo(free_gb=100),
os=OsInfo(distro="linux"),
)

mock_installer = AsyncMock()
Expand Down Expand Up @@ -257,13 +264,13 @@ async def test_setup_fails_clearly_when_no_compatible_backend(self):
context_window=0,
)
fake_registry = SimpleNamespace(get=lambda _id: fake_manifest)
fake_hw = SimpleNamespace(
fake_hw = HardwareProfile(
ram_mb=4096,
cpu={"arch": "x86_64"},
gpu={"type": "none"},
npu={"type": "none"},
disk={"free_gb": 100},
os={"distro": "linux"},
cpu=CpuInfo(arch="x86_64"),
gpu=GpuInfo(type="none"),
npu=NpuInfo(type="none"),
disk=DiskInfo(free_gb=100),
os=OsInfo(distro="linux"),
)

await _run_setup(
Expand Down
Loading