Skip to content

Commit cc6470f

Browse files
fixing
1 parent bd60f94 commit cc6470f

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

services/director-v2/src/simcore_service_director_v2/constants.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from typing import Final
2-
32
# dynamic services
43

54
DYNAMIC_SIDECAR_SERVICE_PREFIX: Final[str] = "dy-sidecar"
@@ -14,7 +13,7 @@
1413
# - itisfoundation
1514
# - 10.0.0.0:8473 (IP & Port)
1615
DYNAMIC_SIDECAR_DOCKER_IMAGE_RE = (
17-
r"(^([_a-zA-Z0-9:.-]+)/)?(dynamic-sidecar):([_a-zA-Z0-9.-]+$)"
16+
r"^(([_a-zA-Z0-9:.-]+)/)?(dynamic-sidecar):([_a-zA-Z0-9.-]+)$"
1817
)
1918

2019
REGEX_DY_SERVICE_SIDECAR = rf"^{DYNAMIC_SIDECAR_SERVICE_PREFIX}_[a-zA-Z0-9-_]*"

services/director-v2/src/simcore_service_director_v2/core/errors.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
class DirectorError(Exception):
2929
"""Basic exception"""
3030

31-
def message(self) -> str:
32-
return f"{self.args[0]}"
33-
3431

3532
class ConfigurationError(DirectorError):
3633
"""An error in the director-v2 configuration"""
@@ -161,7 +158,7 @@ def get_errors(self) -> list[ErrorDict]:
161158
f"{self.project_id}",
162159
f"{self.node_id}",
163160
),
164-
"msg": self.message(),
161+
"msg": f"{self.args[0]}",
165162
"type": self.code,
166163
},
167164
]

services/director-v2/tests/unit/test_modules_dynamic_sidecar_client_api_public.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
from contextlib import contextmanager
55
from typing import Any, AsyncIterable, Callable, Iterator
66
from unittest.mock import AsyncMock
7+
from models_library.api_schemas_dynamic_sidecar.containers import (
8+
ActivityInfoOrNone
9+
)
710

811
import pytest
912
from common_library.json_serialization import json_dumps
@@ -352,21 +355,21 @@ async def test_update_volume_state(
352355

353356

354357
@pytest.mark.parametrize(
355-
"mock_json",
358+
"mock_dict",
356359
[{"seconds_inactive": 1}, {"seconds_inactive": 0}, None],
357360
)
358361
async def test_get_service_activity(
359362
get_patched_client: Callable,
360363
dynamic_sidecar_endpoint: AnyHttpUrl,
361-
mock_json: dict[str, Any],
364+
mock_dict: dict[str, Any],
362365
) -> None:
363366
with get_patched_client(
364367
"get_containers_activity",
365368
return_value=Response(
366-
status_code=status.HTTP_200_OK, text=json_dumps(mock_json)
369+
status_code=status.HTTP_200_OK, text=json_dumps(mock_dict)
367370
),
368371
) as client:
369-
assert await client.get_service_activity(dynamic_sidecar_endpoint) == mock_json
372+
assert await client.get_service_activity(dynamic_sidecar_endpoint) == TypeAdapter(ActivityInfoOrNone).validate_python(mock_dict)
370373

371374

372375
async def test_free_reserved_disk_space(

0 commit comments

Comments
 (0)