fix(simulation): retry temporary provider proxy failures
This commit is contained in:
@@ -14,6 +14,7 @@ from k1link.simulation.gaussian_pipeline_gateway import (
|
||||
GaussianPipelineGateway,
|
||||
GaussianPipelineGatewayError,
|
||||
GaussianPipelineIntegrityError,
|
||||
GaussianPipelineUnavailableError,
|
||||
_discover_bundle_members,
|
||||
)
|
||||
|
||||
@@ -256,6 +257,30 @@ def test_gateway_surfaces_bounded_provider_rejection_detail(tmp_path: Path) -> N
|
||||
))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("status_code", [502, 503, 504])
|
||||
def test_gateway_classifies_temporary_provider_proxy_failures_as_unavailable(
|
||||
tmp_path: Path,
|
||||
status_code: int,
|
||||
) -> None:
|
||||
with (
|
||||
GaussianPipelineGateway(
|
||||
"http://gaussian.test",
|
||||
_token_file(tmp_path),
|
||||
transport=httpx.MockTransport(
|
||||
lambda _request: httpx.Response(
|
||||
status_code,
|
||||
json={"error": "provider_unavailable"},
|
||||
)
|
||||
),
|
||||
) as gateway,
|
||||
pytest.raises(
|
||||
GaussianPipelineUnavailableError,
|
||||
match=rf"HTTP {status_code}.*provider_unavailable",
|
||||
),
|
||||
):
|
||||
gateway.capabilities()
|
||||
|
||||
|
||||
def test_gateway_rejects_incomplete_lcc_bundle(tmp_path: Path) -> None:
|
||||
bundle = tmp_path / "bundle"
|
||||
bundle.mkdir()
|
||||
|
||||
Reference in New Issue
Block a user