mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
fix(config): respect quoted false for session vacuum_after_prune
This commit is contained in:
parent
4fade39c90
commit
7da299ddb0
6 changed files with 94 additions and 15 deletions
34
tests/gateway/test_state_db_auto_maintenance.py
Normal file
34
tests/gateway/test_state_db_auto_maintenance.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from gateway.config import GatewayConfig
|
||||
from gateway.run import GatewayRunner
|
||||
|
||||
|
||||
@pytest.mark.parametrize("raw_value", ["false", False])
|
||||
def test_gateway_runner_respects_vacuum_after_prune_flag(monkeypatch, tmp_path, raw_value):
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
|
||||
fake_db = Mock()
|
||||
monkeypatch.setattr("hermes_state.SessionDB", lambda: fake_db)
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.config.load_config",
|
||||
lambda: {
|
||||
"sessions": {
|
||||
"auto_prune": True,
|
||||
"retention_days": 45,
|
||||
"min_interval_hours": 6,
|
||||
"vacuum_after_prune": raw_value,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
runner = GatewayRunner(GatewayConfig(sessions_dir=tmp_path / "sessions"))
|
||||
|
||||
assert runner._session_db is fake_db
|
||||
fake_db.maybe_auto_prune_and_vacuum.assert_called_once_with(
|
||||
retention_days=45,
|
||||
min_interval_hours=6,
|
||||
vacuum=False,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue