Skip to content

Commit c2e9be5

Browse files
committed
fix: update WEBSERVER_RPC_NAMESPACE in tests to ensure correct environment setup
1 parent ac38fa6 commit c2e9be5

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

services/web/server/tests/integration/01/notifications/test_rabbitmq_consumers.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
ProgressType,
2727
RabbitEventMessageType,
2828
)
29+
from models_library.rpc.webserver import DEFAULT_WEBSERVER_RPC_NAMESPACE
2930
from models_library.users import UserID
3031
from models_library.utils.fastapi_encoders import jsonable_encoder
3132
from pytest_mock import MockerFixture
33+
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
3234
from pytest_simcore.helpers.webserver_users import UserInfoDict
3335
from redis import Redis
3436
from servicelib.aiohttp.application import create_safe_application
@@ -139,10 +141,19 @@ async def client(
139141
redis_client: Redis,
140142
monkeypatch_setenv_from_app_config: Callable,
141143
simcore_services_ready: None,
144+
monkeypatch: pytest.MonkeyPatch,
142145
) -> TestClient:
143146
app_config["storage"]["enabled"] = False
144147
app_config["db"]["postgres"]["minsize"] = 2
145148
monkeypatch_setenv_from_app_config(app_config)
149+
150+
setenvs_from_dict(
151+
monkeypatch,
152+
envs={
153+
"WEBSERVER_RPC_NAMESPACE": DEFAULT_WEBSERVER_RPC_NAMESPACE,
154+
},
155+
)
156+
146157
app = create_safe_application(app_config)
147158

148159
assert setup_settings(app)

services/web/server/tests/integration/01/test_computation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
from models_library.projects_nodes import Node
2222
from models_library.projects_nodes_io import NodeID
2323
from models_library.projects_state import RunningState
24+
from models_library.rpc.webserver import DEFAULT_WEBSERVER_RPC_NAMESPACE
2425
from pydantic import TypeAdapter
2526
from pytest_mock import MockerFixture
2627
from pytest_simcore.helpers.assert_checks import assert_status
28+
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
2729
from servicelib.aiohttp import status
2830
from servicelib.aiohttp.application import create_safe_application
2931
from servicelib.status_codes_utils import get_code_display_name
@@ -133,6 +135,7 @@ async def client(
133135
app_config: dict[str, Any], # waits until swarm with *_services are up
134136
monkeypatch_setenv_from_app_config: Callable,
135137
simcore_services_ready: None,
138+
monkeypatch: pytest.MonkeyPatch,
136139
) -> TestClient:
137140
cfg = deepcopy(app_config)
138141

@@ -143,6 +146,13 @@ async def client(
143146

144147
# fake config
145148
monkeypatch_setenv_from_app_config(cfg)
149+
setenvs_from_dict(
150+
monkeypatch,
151+
envs={
152+
"WEBSERVER_RPC_NAMESPACE": DEFAULT_WEBSERVER_RPC_NAMESPACE,
153+
},
154+
)
155+
146156
app = create_safe_application(app_config)
147157

148158
assert setup_settings(app)

services/web/server/tests/integration/01/test_exporter_requests_handlers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ async def client(
167167

168168
monkeypatch.delenv("WEBSERVER_SCICRUNCH", raising=False)
169169
setenvs_from_dict(
170-
monkeypatch, {"SCICRUNCH_API_KEY": "REPLACE_ME_with_valid_api_key"}
170+
monkeypatch,
171+
{
172+
"SCICRUNCH_API_KEY": "REPLACE_ME_with_valid_api_key",
173+
"WEBSERVER_RPC_NAMESPACE": "null",
174+
},
171175
)
172176

173177
# app setup ----------------------------------

services/web/server/tests/integration/01/test_garbage_collection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from models_library.projects_state import RunningState
2929
from pytest_mock import MockerFixture
3030
from pytest_simcore.helpers import webserver_projects
31+
from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict
3132
from pytest_simcore.helpers.webserver_login import log_client_in
3233
from pytest_simcore.helpers.webserver_users import UserInfoDict
3334
from servicelib.aiohttp import status
@@ -151,6 +152,7 @@ async def client(
151152
rabbit_service: RabbitSettings,
152153
simcore_services_ready: None,
153154
director_v2_service_mock: aioresponses,
155+
monkeypatch: pytest.MonkeyPatch,
154156
) -> TestClient:
155157
cfg = deepcopy(app_config)
156158

@@ -166,6 +168,13 @@ async def client(
166168
)
167169

168170
monkeypatch_setenv_from_app_config(cfg)
171+
setenvs_from_dict(
172+
monkeypatch,
173+
envs={
174+
"WEBSERVER_RPC_NAMESPACE": "null",
175+
},
176+
)
177+
169178
app = create_safe_application(cfg)
170179

171180
# activates only security+restAPI sub-modules

0 commit comments

Comments
 (0)