Фикс таймаута healthy
This commit is contained in:
26
tests/v2/test_health_timeout.py
Normal file
26
tests/v2/test_health_timeout.py
Normal 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
|
||||
Reference in New Issue
Block a user