mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 04:15:09 +00:00
fix(serve): reject a config reload whose validation exits instead of stopping the server
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user