fix(harness): ensure_ollama never raises on start/probe failure (stage server)
This commit is contained in:
@@ -114,3 +114,27 @@ def test_custom_start_cmd_used():
|
||||
sleep=lambda s: None,
|
||||
)
|
||||
assert started[0] == ["docker", "start", "ollama"]
|
||||
|
||||
|
||||
def test_start_failure_is_server_error():
|
||||
r = ensure_ollama(
|
||||
_cfg(), timeout=5, no_start=False,
|
||||
probe=lambda url: False,
|
||||
installed_models=lambda url: set(),
|
||||
start=lambda cmd: (_ for _ in ()).throw(FileNotFoundError("ollama: not found")),
|
||||
warm=lambda cfg: None,
|
||||
sleep=lambda s: None,
|
||||
)
|
||||
assert r["ok"] is False and r["stage"] == "server"
|
||||
assert "avvio" in r["error"].lower() or "not found" in r["error"].lower()
|
||||
|
||||
|
||||
def test_initial_probe_exception_is_server_error():
|
||||
r = ensure_ollama(
|
||||
_cfg(), timeout=5, no_start=False,
|
||||
probe=lambda url: (_ for _ in ()).throw(RuntimeError("boom")),
|
||||
installed_models=lambda url: set(),
|
||||
start=lambda cmd: None,
|
||||
warm=lambda cfg: None,
|
||||
)
|
||||
assert r["ok"] is False and r["stage"] == "server"
|
||||
|
||||
Reference in New Issue
Block a user