test_knowtation_mcp_stress.py
file-level
1
files
1
commits
0
hotspots
0
🧊 dead
0
💥 blast risk
| 1 | """Tier 4 — stress tests for knowtation MCP.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import pathlib |
| 6 | import time |
| 7 | |
| 8 | import pytest |
| 9 | |
| 10 | from muse.mcp.namespaces.knowtation import KnowtationNamespace |
| 11 | from muse.plugins.knowtation.search import hybrid_search |
| 12 | |
| 13 | |
| 14 | @pytest.fixture |
| 15 | def smoke_root() -> pathlib.Path: |
| 16 | return pathlib.Path("/Users/aaronrenecarvajal/MUSE_HUB/knowtation-vault-smoke") |
| 17 | |
| 18 | |
| 19 | def test_search_respects_top_k_clamp(smoke_root: pathlib.Path) -> None: |
| 20 | out = hybrid_search(smoke_root, "note", top_k=100, mode="lexical") |
| 21 | assert len(out["results"]) <= 100 |
| 22 | |
| 23 | |
| 24 | def test_graph_on_smoke_vault(smoke_root: pathlib.Path) -> None: |
| 25 | ns = KnowtationNamespace(smoke_root) |
| 26 | start = time.monotonic() |
| 27 | graph = ns.read_resource("knowtation://graph") |
| 28 | elapsed = time.monotonic() - start |
| 29 | assert graph["notes_indexed"] >= 1 |
| 30 | assert elapsed < 10.0 |
| 31 | |
| 32 | |
| 33 | def test_daily_brief_prompt_large_window(smoke_root: pathlib.Path) -> None: |
| 34 | ns = KnowtationNamespace(smoke_root) |
| 35 | p = ns.get_prompt("vault/daily-brief", {"since_hours": 168}) |
| 36 | assert p["messages"] |