Files
config_manager/tests/v2/test_health_timeout.py

27 lines
908 B
Python

from config_manager.v2 import ConfigManagerV2
class TimeoutApp(ConfigManagerV2):
def execute(self) -> None:
return
def test_health_timeout_uses_main_env_key(tmp_path, monkeypatch):
cfg = tmp_path / "config.yaml"
cfg.write_text("log: {}\nmanagement: { enabled: false }\nhealth_timeout: 150\n", encoding="utf-8")
monkeypatch.setenv("HEALTH_TIMEOUT", "120")
monkeypatch.setenv("HEALTHY_TIMEOUT", "300")
app = TimeoutApp(str(cfg))
assert app._health_timeout == 120.0
def test_health_timeout_defaults_to_90_when_env_not_set(tmp_path, monkeypatch):
cfg = tmp_path / "config.yaml"
cfg.write_text("log: {}\nmanagement: { enabled: false }\nhealth_timeout: 150\n", encoding="utf-8")
monkeypatch.delenv("HEALTH_TIMEOUT", raising=False)
monkeypatch.delenv("HEALTHY_TIMEOUT", raising=False)
app = TimeoutApp(str(cfg))
assert app._health_timeout == 90.0