v2.9.0 (#641)
Co-authored-by: Antoine <33425718+anth2o@users.noreply.github.com> Co-authored-by: Bastien <bastien.baret@gmail.com> Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com> Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai> Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: Robin Gullo <robin.gullo@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
a83c81ecf5
commit
632ea8c032
253 changed files with 13965 additions and 2525 deletions
|
|
@ -2,6 +2,7 @@ from __future__ import annotations
|
|||
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from pydantic import BaseModel, ValidationError
|
||||
import pytest
|
||||
|
||||
from tests.conftest import build_test_vibe_config
|
||||
|
|
@ -281,3 +282,20 @@ class TestBrokerSequenceTracking:
|
|||
|
||||
assert events == []
|
||||
assert source._next_start_seq == 5
|
||||
|
||||
|
||||
def test_consume_workflow_event_validation_error_is_logged_and_ignored() -> None:
|
||||
class _InvalidPayload(BaseModel):
|
||||
required: str
|
||||
|
||||
source = _make_source()
|
||||
with pytest.raises(ValidationError) as exc_info:
|
||||
_InvalidPayload.model_validate({})
|
||||
|
||||
source._translator.consume_workflow_event = MagicMock(side_effect=exc_info.value)
|
||||
|
||||
with patch("vibe.core.nuage.remote_events_source.logger.warning") as mock_warning:
|
||||
events = source._consume_workflow_event(MagicMock())
|
||||
|
||||
assert events == []
|
||||
mock_warning.assert_called_once()
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from vibe.core.nuage.client import WorkflowsClient
|
||||
from vibe.core.nuage.exceptions import ErrorCode, WorkflowsException
|
||||
from vibe.core.nuage.streaming import StreamEvent, StreamEventsQueryParams
|
||||
from vibe.core.nuage.workflow import WorkflowExecutionStatus
|
||||
|
||||
|
||||
def _make_client() -> WorkflowsClient:
|
||||
|
|
@ -198,6 +199,47 @@ class TestStreamEvents:
|
|||
assert "Failed to stream events" in exc_info.value.message
|
||||
|
||||
|
||||
class TestGetWorkflowRuns:
|
||||
@pytest.mark.asyncio
|
||||
async def test_sends_current_user_filter_by_default(self) -> None:
|
||||
client = _make_client()
|
||||
mock_response = MagicMock()
|
||||
mock_response.raise_for_status.return_value = None
|
||||
mock_response.json.return_value = {"executions": [], "next_page_token": None}
|
||||
|
||||
mock_http = AsyncMock()
|
||||
mock_http.get.return_value = mock_response
|
||||
client._client = mock_http
|
||||
|
||||
await client.get_workflow_runs(
|
||||
workflow_identifier="workflow-1",
|
||||
page_size=10,
|
||||
status=[WorkflowExecutionStatus.RUNNING],
|
||||
)
|
||||
|
||||
mock_http.get.assert_awaited_once()
|
||||
call_params = mock_http.get.call_args.kwargs["params"]
|
||||
assert call_params["user_id"] == "current"
|
||||
assert call_params["workflow_identifier"] == "workflow-1"
|
||||
assert call_params["page_size"] == 10
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_allows_overriding_user_id(self) -> None:
|
||||
client = _make_client()
|
||||
mock_response = MagicMock()
|
||||
mock_response.raise_for_status.return_value = None
|
||||
mock_response.json.return_value = {"executions": [], "next_page_token": None}
|
||||
|
||||
mock_http = AsyncMock()
|
||||
mock_http.get.return_value = mock_response
|
||||
client._client = mock_http
|
||||
|
||||
await client.get_workflow_runs(user_id="user-123")
|
||||
|
||||
call_params = mock_http.get.call_args.kwargs["params"]
|
||||
assert call_params["user_id"] == "user-123"
|
||||
|
||||
|
||||
def _async_line_iter(lines: list[str]):
|
||||
async def _iter():
|
||||
for line in lines:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue