mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-30 19:09:28 +00:00
test: age the disk L2 entry too in the server-swap redetection test
The TTL-expiry test aged only the in-process probe cache; with the new disk L2 the fresh disk verdict (correctly) served 'ollama' and the swap to lm-studio wasn't re-detected. In real time-flow the 300s disk TTL always lapses before the 1h in-proc TTL — the test now compresses both expiries, matching the scenario it describes. 25/25 pass.
This commit is contained in:
parent
d7a4065568
commit
c92e2c0fbf
1 changed files with 13 additions and 0 deletions
|
|
@ -158,6 +158,19 @@ class TestDetectLocalServerTypeCache:
|
|||
model_metadata._endpoint_probe_path_cache[key] = (
|
||||
val, _time.monotonic() - model_metadata._ENDPOINT_PROBE_TTL_SECONDS - 1,
|
||||
)
|
||||
# Age the disk L2 entry too. Its TTL (300s) is much shorter than the
|
||||
# in-proc TTL (1h), so in real time-flow it always expires first —
|
||||
# this test compresses both expiries into one instant.
|
||||
import json as _json
|
||||
_disk = model_metadata._local_probe_disk_cache_path()
|
||||
if _disk.exists():
|
||||
_data = _json.loads(_disk.read_text(encoding="utf-8"))
|
||||
for _entry in _data.values():
|
||||
if isinstance(_entry, dict):
|
||||
_entry["ts"] = (
|
||||
_time.time() - model_metadata._LOCAL_PROBE_DISK_TTL_SECONDS - 1
|
||||
)
|
||||
_disk.write_text(_json.dumps(_data), encoding="utf-8")
|
||||
|
||||
lmstudio_resp = MagicMock()
|
||||
lmstudio_resp.status_code = 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue