mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-30 01:41:43 +00:00
34 lines
994 B
Python
34 lines
994 B
Python
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,
|
|
)
|