強化 Ollama host health runtime 探針
This commit is contained in:
@@ -133,6 +133,44 @@ def test_host_health_transition_alert_keeps_db_dedup_window(monkeypatch):
|
||||
assert "_push_host_transition_alert(tr)" in source
|
||||
|
||||
|
||||
def test_host_health_probe_verifies_gcp_embedding_runtime(monkeypatch):
|
||||
run_scheduler = _load_run_scheduler(monkeypatch)
|
||||
|
||||
class Resp:
|
||||
status_code = 200
|
||||
|
||||
def json(self):
|
||||
return {"embeddings": [[0.1, 0.2, 0.3]]}
|
||||
|
||||
ok, err = run_scheduler._probe_ollama_embedding_runtime(
|
||||
type("Requests", (), {"post": staticmethod(lambda *args, **kwargs: Resp())}),
|
||||
"http://34.21.145.224:11434",
|
||||
)
|
||||
|
||||
assert ok is True
|
||||
assert err is None
|
||||
assert run_scheduler._host_health_model_probe_enabled("Primary (GCP)") is True
|
||||
assert run_scheduler._host_health_model_probe_enabled("Secondary (GCP)") is True
|
||||
assert run_scheduler._host_health_model_probe_enabled("Fallback (111)") is False
|
||||
|
||||
|
||||
def test_host_health_probe_reports_embedding_runtime_failure(monkeypatch):
|
||||
run_scheduler = _load_run_scheduler(monkeypatch)
|
||||
|
||||
class Requests:
|
||||
@staticmethod
|
||||
def post(*_args, **_kwargs):
|
||||
raise TimeoutError("embed timeout")
|
||||
|
||||
ok, err = run_scheduler._probe_ollama_embedding_runtime(
|
||||
Requests,
|
||||
"http://34.21.145.224:11434",
|
||||
)
|
||||
|
||||
assert ok is False
|
||||
assert "EmbedProbe TimeoutError" in err
|
||||
|
||||
|
||||
def test_v2_cron_blind_spot_list_has_failure_notifications(monkeypatch):
|
||||
run_scheduler = _load_run_scheduler(monkeypatch)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user