fix: enforce lifecycle response identities
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Any, cast
|
||||
import pytest
|
||||
|
||||
from wf_client import App, Run, WorkflowClientPort
|
||||
from wf_client.errors import InvalidResponse
|
||||
from wf_client.errors import DeploymentNotRunnable, InvalidResponse
|
||||
|
||||
|
||||
def _payload(
|
||||
@@ -150,6 +150,15 @@ async def test_malformed_interrupt_route_is_invalid_response() -> None:
|
||||
Run.from_payload(cast(WorkflowClientPort, _Port()), payload)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_missing_run_id_preserves_server_error() -> None:
|
||||
payload = _payload(run_id=None, status="failed")
|
||||
payload["error"] = "server refused to start"
|
||||
with pytest.raises(DeploymentNotRunnable) as captured:
|
||||
Run.from_payload(cast(WorkflowClientPort, _Port()), payload)
|
||||
assert captured.value.error == "server refused to start"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_non_resumable_run_is_rejected_before_io() -> None:
|
||||
port = _Port()
|
||||
|
||||
Reference in New Issue
Block a user