test: cover durable conversation files after restart
This commit is contained in:
1 parent
d0ed244294
commit
ddd999c938
1 file changed
+23
@@ -0,0 +1,23 @@
|
||||
"""Regression coverage for session persistence on the mounted data directory."""
|
||||
|
||||
from google.genai import types
|
||||
|
||||
from homeagent.agent.conversation import ConversationManager
|
||||
|
||||
|
||||
def test_conversation_file_survives_restart_and_is_atomic(tmp_path):
|
||||
manager = ConversationManager(tmp_path, max_turns=5)
|
||||
manager.append_content(
|
||||
42,
|
||||
None,
|
||||
types.Content(role="user", parts=[types.Part.from_text(text="persist me")]),
|
||||
)
|
||||
|
||||
session_file = tmp_path / "sessions" / "session_42_main.json"
|
||||
assert session_file.exists()
|
||||
assert not list(session_file.parent.glob("*.tmp"))
|
||||
|
||||
restarted = ConversationManager(tmp_path, max_turns=5)
|
||||
history = restarted.get_history(42, None)
|
||||
assert len(history) == 1
|
||||
assert history[0].parts[0].text == "persist me"
|
||||
Reference in new issue
Block a user