From c92e2c0fbf9bc436c5ecbb5b68ae0b481a024fac Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 10:15:32 -0700 Subject: [PATCH] test: age the disk L2 entry too in the server-swap redetection test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/agent/test_probe_cache_followups.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/agent/test_probe_cache_followups.py b/tests/agent/test_probe_cache_followups.py index f775b3f877e..7d87516a407 100644 --- a/tests/agent/test_probe_cache_followups.py +++ b/tests/agent/test_probe_cache_followups.py @@ -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