You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ADN-DMR-Peer-Server/tests/bridge/test_config_reload.py

39 lines
1.1 KiB

"""Config reload merge preserves runtime MASTER state."""
from __future__ import annotations
from adn_server.infrastructure.config_reload import merge_system_config
def test_merge_system_config_preserves_peers_and_static_tgs() -> None:
old = {
"MODE": "MASTER",
"ENABLED": True,
"IP": "127.0.0.1",
"PORT": 62031,
"PEERS": {"1001": {"IP": "10.0.0.1"}},
"OPTIONS": "TS2=52090;TIMER=10",
"TS1_STATIC": "91",
"TS2_STATIC": "52090",
"DEFAULT_UA_TIMER": 10,
"_options_static_apply_fp": "52090|10",
}
new = {
"MODE": "MASTER",
"ENABLED": True,
"IP": "127.0.0.1",
"PORT": 62031,
"GROUP_HANGTIME": 3,
"TS1_STATIC": "",
"TS2_STATIC": "",
}
merged = merge_system_config(old, new)
assert merged["PEERS"] == old["PEERS"]
assert merged["OPTIONS"] == old["OPTIONS"]
assert merged["TS1_STATIC"] == old["TS1_STATIC"]
assert merged["TS2_STATIC"] == old["TS2_STATIC"]
assert merged["_options_static_apply_fp"] == old["_options_static_apply_fp"]
assert merged["GROUP_HANGTIME"] == 3

Powered by TurnKey Linux.