Migrate all repos into monorepo context folders
Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)
Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from teamlandkarte_mcp.cache.search_cache import SearchCache
|
||||
|
||||
|
||||
def test_cache_diagnostics_has_instance_id_and_ttl() -> None:
|
||||
cache = SearchCache(ttl_minutes=1, max_size=2, enable_diagnostics=True)
|
||||
diag = cache.diagnostics()
|
||||
assert isinstance(diag["instance_id"], str)
|
||||
assert diag["ttl_seconds"] == 60
|
||||
assert diag["max_size"] == 2
|
||||
assert diag["size"] == 0
|
||||
|
||||
|
||||
def test_ttl_like_miss_leads_to_none() -> None:
|
||||
cache = SearchCache(ttl_minutes=1, max_size=10, enable_diagnostics=True)
|
||||
search_id = cache.store_search(
|
||||
task_id=None, requirements={}, results={"by_category": {}}
|
||||
)
|
||||
|
||||
# Real-time TTL expiry would require sleeping > 60s. Instead, we assert
|
||||
# miss semantics by removing the entry and verifying get() returns None.
|
||||
cache._cache.pop(search_id, None) # type: ignore[attr-defined]
|
||||
|
||||
assert cache.get(search_id) is None
|
||||
|
||||
|
||||
def test_max_size_eviction_can_remove_search_id() -> None:
|
||||
cache = SearchCache(ttl_minutes=60, max_size=1, enable_diagnostics=True)
|
||||
first = cache.store_search(
|
||||
task_id=None, requirements={}, results={"by_category": {}}
|
||||
)
|
||||
_ = cache.store_search(task_id=None, requirements={}, results={"by_category": {}})
|
||||
assert cache.get(first) is None
|
||||
|
||||
|
||||
def test_add_filter_unknown_search_id_raises_keyerror() -> None:
|
||||
cache = SearchCache(ttl_minutes=60, max_size=10, enable_diagnostics=True)
|
||||
with pytest.raises(KeyError):
|
||||
cache.add_filter("does-not-exist", filtered_results={}, filter_meta={})
|
||||
diag = cache.diagnostics()
|
||||
assert diag["misses"] >= 0
|
||||
Reference in New Issue
Block a user