Фикс таймаута healthy

This commit is contained in:
2026-02-26 22:47:42 +03:00
parent d239454cfb
commit 06d9ef2868
3 changed files with 53 additions and 5 deletions

View File

@@ -0,0 +1,26 @@
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