Skip to content

Commit 3aff143

Browse files
committed
refactor: update environment mock fixtures and add WEBSERVER_RPC_NAMESPACE
1 parent 9beb370 commit 3aff143

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

services/web/server/tests/unit/isolated/conftest.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,14 @@ def mock_env_deployer_pipeline(monkeypatch: pytest.MonkeyPatch) -> EnvVarsDict:
101101

102102
@pytest.fixture
103103
def mock_env_devel_environment(
104-
mock_env_devel_environment: EnvVarsDict, # pylint: disable=redefined-outer-name
104+
env_devel_dict: EnvVarsDict,
105105
monkeypatch: pytest.MonkeyPatch,
106106
) -> EnvVarsDict:
107107
# Overrides to ensure dev-features are enabled testings
108-
return mock_env_devel_environment | setenvs_from_dict(
108+
return setenvs_from_dict(
109109
monkeypatch,
110110
envs={
111+
**env_devel_dict,
111112
"WEBSERVER_DEV_FEATURES_ENABLED": "1",
112113
"TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT": "null",
113114
"TRACING_OPENTELEMETRY_COLLECTOR_PORT": "null",
@@ -184,10 +185,9 @@ def mock_env_dockerfile_build(monkeypatch: pytest.MonkeyPatch) -> EnvVarsDict:
184185
def mock_webserver_service_environment(
185186
monkeypatch: pytest.MonkeyPatch,
186187
mock_env_makefile: EnvVarsDict,
187-
mock_env_devel_environment: EnvVarsDict,
188188
mock_env_dockerfile_build: EnvVarsDict,
189189
mock_env_deployer_pipeline: EnvVarsDict,
190-
mock_webserver_service_environment: EnvVarsDict,
190+
docker_compose_service_environment_dict: EnvVarsDict,
191191
service_name: str,
192192
) -> EnvVarsDict:
193193
"""
@@ -232,13 +232,12 @@ def mock_webserver_service_environment(
232232
"SWARM_STACK_NAME": os.environ.get("SWARM_STACK_NAME", "simcore"),
233233
"WEBSERVER_LOGLEVEL": os.environ.get("LOG_LEVEL", "WARNING"),
234234
"SESSION_COOKIE_MAX_AGE": str(7 * 24 * 60 * 60),
235-
**mock_webserver_service_environment,
235+
**docker_compose_service_environment_dict,
236236
},
237237
)
238238

239239
envs = (
240240
mock_env_makefile
241-
| mock_env_devel_environment
242241
| mock_env_dockerfile_build
243242
| mock_env_deployer_pipeline
244243
| mock_envs_docker_compose_environment

services/web/server/tests/unit/isolated/scicrunch/test_scicrunch_service_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def mock_scicrunch_service_resolver(
104104

105105
@pytest.fixture
106106
async def app(
107-
mock_env_devel_environment: EnvVarsDict,
107+
mock_webserver_service_environment: EnvVarsDict,
108108
aiohttp_server: Callable,
109109
mocker: MockerFixture,
110110
) -> web.Application:

services/web/server/tests/unit/isolated/test_activity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def app_environment(
8888
"WEBSERVER_LOGLEVEL": "DEBUG",
8989
"WEBSERVER_PORT": "8080",
9090
"WEBSERVER_STUDIES_ACCESS_ENABLED": "True",
91+
"WEBSERVER_RPC_NAMESPACE": "null",
9192
},
9293
)
9394

services/web/server/tests/unit/isolated/test_application_settings.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ def test_settings_to_client_statics(app_settings: ApplicationSettings):
7171

7272

7373
def test_settings_to_client_statics_plugins(
74-
mock_webserver_service_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch
74+
mock_webserver_service_environment: EnvVarsDict,
75+
monkeypatch: pytest.MonkeyPatch,
7576
):
77+
setenvs_from_dict(
78+
monkeypatch,
79+
{
80+
"WEBSERVER_DEV_FEATURES_ENABLED": "1",
81+
},
82+
)
7683
monkeypatch.delenv("WEBSERVER_REALTIME_COLLABORATION", raising=False)
7784

7885
# explicitly disable these plugins

services/web/server/tests/unit/isolated/test_application_settings_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def test_settings_infered_from_default_tests_config(
1616
k: f"{v}" for k, v in convert_to_environ_vars(default_app_cfg).items()
1717
}
1818

19-
settings = ApplicationSettings.create_from_envs()
19+
settings = ApplicationSettings.create_from_envs(WEBSERVER_RPC_NAMESPACE=None)
2020

2121
assert convert_to_app_config(settings)

services/web/server/tests/unit/isolated/test_diagnostics_healthcheck.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def mock_environment(
9898
}
9999
),
100100
"SC_HEALTHCHECK_TIMEOUT": "2m",
101+
"WEBSERVER_RPC_NAMESPACE": "null",
101102
},
102103
)
103104

0 commit comments

Comments
 (0)