fix(serve): reject a config reload whose validation exits instead of stopping the server

This commit is contained in:
imSp4rky
2026-11-28 16:03:35 -07:00
parent ab338e4a3c
commit ed743a81b9
3 changed files with 25 additions and 8 deletions
+15
View File
@@ -73,6 +73,21 @@ def test_invalid_file_keeps_the_running_config(running: tuple[web.Application, P
assert config.serve["users"] == {"old": {"devices": ["dev"]}}
def test_config_check_that_exits_is_rejected_not_fatal(
running: tuple[web.Application, Path], caplog: pytest.LogCaptureFixture
) -> None:
app, path = running
path.write_text(yaml.safe_dump({"filename_replacements": {"&": None}}), encoding="utf8")
with caplog.at_level(logging.ERROR, logger=LOG.name):
assert _reload(app) is False
assert [r.getMessage() for r in caplog.records] == [
"Config reload rejected, keeping the running config: filename_replacements must map text to text, not {'&': None}"
]
assert set(app["config"]["users"]) == {"old", "api"}
assert config.serve["users"] == {"old": {"devices": ["dev"]}}
def test_restart_only_change_is_reported_not_applied(
running: tuple[web.Application, Path], caplog: pytest.LogCaptureFixture
) -> None: