From bc3ecbdcfbb874f7c583e7f872a4504cf7c199e7 Mon Sep 17 00:00:00 2001 From: Barsic <16+barsic@noreply.localhost> Date: Fri, 13 Nov 2026 22:10:36 +0300 Subject: [PATCH] test: verify configured memory path is authoritative --- tests/test_persistent_memory.py | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/tests/test_persistent_memory.py b/tests/test_persistent_memory.py index d505b5a..c60d09d 100644 --- a/tests/test_persistent_memory.py +++ b/tests/test_persistent_memory.py @@ -1,26 +1,14 @@ -"""Regression tests for durable global memory.""" +"""Regression coverage for configured global-memory location.""" -from homeagent.memory.global_memory import GlobalMemory, get_global_memory +from homeagent.memory.global_memory import configure_global_memory_path, get_global_memory -def test_global_memory_survives_new_instance_and_uses_atomic_file(tmp_path): - path = tmp_path / "data" / "global_memory.json" - memory = GlobalMemory(path) - item = memory.add_fact("Не терять память после рестарта", category="reliability") +def test_configured_memory_path_is_used(tmp_path): + configured = tmp_path / "mounted-data" / "global_memory.json" + configure_global_memory_path(configured) - restarted = GlobalMemory(path) - assert restarted.search("рестарта")[0].id == item.id - assert path.read_text(encoding="utf-8").startswith("[") - assert not list(path.parent.glob("*.tmp")) + memory = get_global_memory() + memory.add_fact("configured path survives restart") - -def test_global_memory_singleton_isolated_by_path(tmp_path): - first_path = tmp_path / "one.json" - second_path = tmp_path / "two.json" - - first = get_global_memory(first_path) - second = get_global_memory(second_path) - assert first is not second - - first.add_fact("только в первом хранилище") - assert second.list_facts() == [] + assert configured.exists() + assert "configured path survives restart" in configured.read_text(encoding="utf-8")