Add single-command LLM connection probe

This commit is contained in:
Nico committed 2026-10-14 16:36:30 +02:00
1 parent 4d0edc030d
commit 5f3680b003
2 files changed
+66

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import json
import pytest
import viano_bug_analysis.connection_test as connection
from viano_bug_analysis.llm import ProviderResponse, ProviderUnavailable
from test_llm_gateway import Adapter, provider
from viano_bug_analysis.llm import GatewayConfig, LLMGateway
@pytest.mark.parametrize("response,status", [
(ProviderResponse({"answer": "ok"}, "fixture", 1, 1), "SUCCESS"),
(ProviderUnavailable("LLM_HTTP_TEMPORARY", http_status=503), "UNAVAILABLE"),
])
def test_one_round_no_workspace_files(tmp_path, monkeypatch, capsys, response, status):
adapter = Adapter({"first": response})
gateway = LLMGateway(GatewayConfig((provider(),)), {"fixture": adapter})
monkeypatch.setattr(connection, "preflight", lambda path: gateway)
monkeypatch.chdir(tmp_path)
exit_code = connection.main([])
result = json.loads(capsys.readouterr().out)
assert result["status"] == status
assert exit_code == (0 if status == "SUCCESS" else 2)
assert adapter.calls == ["first"] and not list(tmp_path.iterdir())
if status == "UNAVAILABLE":
assert result["attempts"][0]["http_status"] == 503