Skip to content

Commit 2bc4d08

Browse files
Add support for underscores in DYNAMIC_SIDECAR_DOCKER_IMAGE_RE (ITISFoundation#3139)
* Add support for underscores in DYNAMIC_SIDECAR_DOCKER_IMAGE_RE * adds test * add more regex tests * Refactor REGEX tests Co-authored-by: Dustin Kaiser <[email protected]> Co-authored-by: Pedro Crespo-Valero <[email protected]>
1 parent 1449f68 commit 2bc4d08

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# - itisfoundation
1313
# - 10.0.0.0:8473 (IP & Port)
1414
DYNAMIC_SIDECAR_DOCKER_IMAGE_RE = (
15-
r"(^([a-zA-Z0-9:.-]+)/)?(dynamic-sidecar):([a-zA-Z0-9.-]+$)"
15+
r"(^([_a-zA-Z0-9:.-]+)/)?(dynamic-sidecar):([_a-zA-Z0-9.-]+$)"
1616
)
1717

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

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# pylint:disable=unused-argument
33
# pylint:disable=redefined-outer-name
44

5-
from typing import Any, Dict, List, Set
5+
from typing import Any
66

77
import pytest
88
from _pytest.monkeypatch import MonkeyPatch
@@ -18,7 +18,7 @@
1818
)
1919

2020

21-
def _get_backend_type_options() -> Set[str]:
21+
def _get_backend_type_options() -> set[str]:
2222
return {x for x in dir(S3Provider) if not x.startswith("_")}
2323

2424

@@ -64,7 +64,7 @@ def test_enforce_r_clone_requirement(monkeypatch: MonkeyPatch) -> None:
6464
RCloneSettings()
6565

6666

67-
def test_settings_with_project_env_devel(project_env_devel_environment: Dict[str, Any]):
67+
def test_settings_with_project_env_devel(project_env_devel_environment: dict[str, Any]):
6868
# loads from environ
6969
settings = AppSettings.create_from_envs()
7070
print("captured settings: \n", settings.json(indent=2))
@@ -75,7 +75,7 @@ def test_settings_with_project_env_devel(project_env_devel_environment: Dict[str
7575
assert settings.POSTGRES.dsn == "postgresql://test:test@localhost:5432/test"
7676

7777

78-
def test_settings_with_env_devel(mock_env_devel_environment: Dict[str, str]):
78+
def test_settings_with_env_devel(mock_env_devel_environment: dict[str, str]):
7979
settings = AppSettings.create_from_envs()
8080
print("captured settings: \n", settings.json(indent=2))
8181
assert settings
@@ -87,6 +87,12 @@ def test_settings_with_env_devel(mock_env_devel_environment: Dict[str, str]):
8787
"local/dynamic-sidecar:production",
8888
"itisfoundation/dynamic-sidecar:merge-github-testbuild-latest",
8989
"itisfoundation/dynamic-sidecar:1.0.0",
90+
"itisfoundation/dynamic-sidecar:staging-github-staging_diolkos1-2022-06-15--15-04.75ddf7e3fb86944ef95fcf77e4075464848121f1",
91+
"itisfoundation/dynamic-sidecar:hotfix-github-2022-06-24--12-34.162bfe899d6b62d808e70a07da280fd390bc4434",
92+
"itisfoundation/dynamic-sidecar:hotfix-v1-28-1-github-testbuild-latest",
93+
"itisfoundation/dynamic-sidecar:staging-github-latest",
94+
"itisfoundation/dynamic-sidecar:release-github-v1.28.0-2022-05-30--14-52.62c4c48b1846ecaa8280773f48a2f14bf0f3047b",
95+
"itisfoundation/dynamic-sidecar:master-github-2022-06-24--14-35.38add6817bc8cafabc14ec7dacd9b249daa3a11e",
9096
"local/dynamic-sidecar:sadasd",
9197
"itisfoundation/dynamic-sidecar:sadasd",
9298
"10.10.10.10.no.ip:8080/dynamic-sidecar:10.0.1",
@@ -118,8 +124,8 @@ def test_dynamic_sidecar_settings(testing_environ_expected_success: str) -> None
118124

119125
@pytest.fixture(
120126
params=[
121-
"10.10.10.10.no_ip:8080/dynamic-sidecar:sadasd",
122-
"10.10.10.10.no.ip:8080/dynamic-sidecar:the_tag",
127+
"10.10.10.10.no/ip:8080/dynamic-sidecar:sadasd",
128+
"10.10.10.10.no$ip:8080/dynamic-sidecar:the_tag",
123129
],
124130
)
125131
def testing_environ_expected_failure(
@@ -150,7 +156,7 @@ def test_expected_failure_dynamic_sidecar_settings(
150156
)
151157
def test_services_custom_constraints(
152158
custom_constraints: str,
153-
expected: List[str],
159+
expected: list[str],
154160
project_env_devel_environment,
155161
monkeypatch: MonkeyPatch,
156162
) -> None:

0 commit comments

Comments
 (0)