File tree Expand file tree Collapse file tree 3 files changed +57
-1
lines changed
models-library/src/models_library/api_schemas_directorv2
pytest-simcore/src/pytest_simcore/helpers
services/api-server/tests/unit/api_functions Expand file tree Collapse file tree 3 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,25 @@ class TaskLogFileIdGet(BaseModel):
130130 task_id : NodeID
131131 file_id : SimcoreS3FileID | None
132132
133+ model_config = ConfigDict (
134+ json_schema_extra = {
135+ "examples" : [
136+ {
137+ "task_id" : "3fa85f64-5717-4562-b3fc-2c963f66afa6" ,
138+ "file_id" : "1c46752c-b096-11ea-a3c4-02420a00392e/3fa85f64-5717-4562-b3fc-2c963f66afa6/logs/task_logs.txt" ,
139+ },
140+ {
141+ "task_id" : "6ba7b810-9dad-11d1-80b4-00c04fd430c8" ,
142+ "file_id" : "1c46752c-b096-11ea-a3c4-02420a00392e/6ba7b810-9dad-11d1-80b4-00c04fd430c8/logs/debug.log" ,
143+ },
144+ {
145+ "task_id" : "6ba7b811-9dad-11d1-80b4-00c04fd430c8" ,
146+ "file_id" : None ,
147+ },
148+ ]
149+ }
150+ )
151+
133152
134153class TasksSelection (BaseModel ):
135154 nodes_ids : list [NodeID ]
Original file line number Diff line number Diff line change 1+ # pylint: disable=no-self-use
2+ # pylint: disable=not-context-manager
3+ # pylint: disable=protected-access
4+ # pylint: disable=redefined-outer-name
5+ # pylint: disable=unused-argument
6+ # pylint: disable=unused-variable
7+
8+
9+ from models_library .api_schemas_directorv2 .computations import TaskLogFileIdGet
10+ from models_library .projects import ProjectID
11+ from pydantic import TypeAdapter , validate_call
12+ from pytest_mock import MockType
13+ from servicelib .rabbitmq ._client_rpc import RabbitMQRPCClient
14+
15+
16+ class DirectorV2SideEffects :
17+ # pylint: disable=no-self-use
18+ @validate_call (config = {"arbitrary_types_allowed" : True })
19+ async def get_computation_task_log_file_ids (
20+ self ,
21+ rpc_client : RabbitMQRPCClient | MockType ,
22+ * ,
23+ project_id : ProjectID ,
24+ ) -> list [TaskLogFileIdGet ]:
25+ assert rpc_client
26+ assert project_id
27+
28+ return TypeAdapter (list [TaskLogFileIdGet ]).validate_python (
29+ TaskLogFileIdGet .model_json_schema ()["examples" ],
30+ )
Original file line number Diff line number Diff line change @@ -889,7 +889,14 @@ async def test_export_logs(
889889 auth : httpx .BasicAuth ,
890890 user_id : UserID ,
891891):
892+ mock_handler_in_functions_rpc_interface (
893+ "get_function" , mock_registered_project_function
894+ )
895+ mock_handler_in_functions_rpc_interface (
896+ "get_function_job" , mock_registered_function_job
897+ )
898+
892899 response = await client .post (
893- f"{ API_VTAG } /functions/{ mock_registered_project_function .uid } /export_logs " ,
900+ f"{ API_VTAG } /functions/{ mock_registered_project_function .uid } /logs " ,
894901 auth = auth ,
895902 )
You can’t perform that action at this time.
0 commit comments