@@ -65,7 +65,18 @@ def mock_env(
6565 minio_s3_settings_envs : EnvVarsDict ,
6666 storage_service : URL ,
6767 network_name : str ,
68+ services_endpoint : dict [str , URL ],
6869) -> EnvVarsDict :
70+ director_host = services_endpoint ["director" ].host
71+ assert director_host
72+ director_port = services_endpoint ["director" ].port
73+ assert director_port
74+
75+ catalog_host = services_endpoint ["catalog" ].host
76+ assert catalog_host
77+ catalog_port = services_endpoint ["catalog" ].port
78+ assert catalog_port
79+
6980 env_vars : EnvVarsDict = {
7081 "DYNAMIC_SIDECAR_PROMETHEUS_SERVICE_LABELS" : "{}" ,
7182 "TRAEFIK_SIMCORE_ZONE" : "test_traefik_zone" ,
@@ -81,6 +92,10 @@ def mock_env(
8192 "COMPUTATIONAL_BACKEND_ENABLED" : "false" ,
8293 "R_CLONE_PROVIDER" : "MINIO" ,
8394 "DIRECTOR_V2_PROMETHEUS_INSTRUMENTATION_ENABLED" : "1" ,
95+ "DIRECTOR_HOST" : director_host ,
96+ "DIRECTOR_PORT" : f"{ director_port } " ,
97+ "CATALOG_HOST" : catalog_host ,
98+ "CATALOG_PORT" : f"{ catalog_port } " ,
8499 }
85100 setenvs_from_dict (monkeypatch , env_vars )
86101 monkeypatch .delenv ("DYNAMIC_SIDECAR_MOUNT_PATH_DEV" , raising = False )
@@ -159,7 +174,7 @@ def _assemble_node_data(spec: dict, label: str) -> dict[str, str]:
159174@pytest .fixture
160175async def ensure_services_stopped (
161176 dy_static_file_server_project : ProjectAtDB ,
162- minimal_app : FastAPI ,
177+ initialized_app : FastAPI ,
163178) -> AsyncIterable [None ]:
164179 yield
165180 # ensure service cleanup when done testing
@@ -178,7 +193,7 @@ async def ensure_services_stopped(
178193
179194 # pylint: disable=protected-access
180195 scheduler_interval = (
181- minimal_app .state .settings .DYNAMIC_SERVICES .DYNAMIC_SCHEDULER .DIRECTOR_V2_DYNAMIC_SCHEDULER_INTERVAL
196+ initialized_app .state .settings .DYNAMIC_SERVICES .DYNAMIC_SCHEDULER .DIRECTOR_V2_DYNAMIC_SCHEDULER_INTERVAL
182197 )
183198 # sleep enough to ensure the observation cycle properly stopped the service
184199 await asyncio .sleep (2 * scheduler_interval .total_seconds ())
@@ -213,9 +228,8 @@ async def _mocked_context_manger(*args, **kwargs) -> AsyncIterator[None]:
213228 )
214229
215230
216- @pytest .mark .flaky (max_runs = 3 )
217231async def test_legacy_and_dynamic_sidecar_run (
218- minimal_app : FastAPI ,
232+ initialized_app : FastAPI ,
219233 wait_for_catalog_service : Callable [[UserID , str ], Awaitable [None ]],
220234 dy_static_file_server_project : ProjectAtDB ,
221235 user_dict : dict [str , Any ],
@@ -264,13 +278,7 @@ async def test_legacy_and_dynamic_sidecar_run(
264278 if is_legacy (node ):
265279 continue
266280
267- # NOTE: it seems the minimal_app fixture does not contain the actual data
268- # so we use the one in the async_client??? very strange
269- await patch_dynamic_service_url (
270- # pylint: disable=protected-access
271- app = async_client ._transport .app , # noqa: SLF001 # type: ignore
272- node_uuid = node_id ,
273- )
281+ await patch_dynamic_service_url (app = initialized_app , node_uuid = node_id )
274282
275283 assert len (dy_static_file_server_project .workbench ) == 3
276284
0 commit comments