Skip to content

Commit 898c9c5

Browse files
committed
fixed sidecar test by using both versions of node ports
1 parent d8fe51c commit 898c9c5

File tree

1 file changed

+66
-31
lines changed

1 file changed

+66
-31
lines changed

services/sidecar/tests/integration/test_sidecar.py

Lines changed: 66 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# pylint: disable=redefined-outer-name
33
# pylint: disable=too-many-arguments
44
import asyncio
5+
import importlib
56
import inspect
67
import json
78
from collections import deque
@@ -178,7 +179,12 @@ async def _assert_incoming_data_logs(
178179
return (sidecar_logs, tasks_logs, progress_logs)
179180

180181

181-
@pytest.fixture
182+
@pytest.fixture(
183+
params=[
184+
"node_ports",
185+
"node_ports_v2",
186+
]
187+
)
182188
async def pipeline(
183189
sidecar_config: None,
184190
postgres_host_config: Dict[str, str],
@@ -189,16 +195,18 @@ async def pipeline(
189195
pipeline_cfg: Dict,
190196
mock_dir: Path,
191197
user_id: int,
198+
request,
192199
) -> ComputationalPipeline:
193200
"""creates a full pipeline.
194201
NOTE: 'pipeline', defined as parametrization
195202
"""
196-
from simcore_sdk import node_ports_v2
197203

198204
tasks = {key: osparc_service for key in pipeline_cfg}
199205
dag = {key: pipeline_cfg[key]["next"] for key in pipeline_cfg}
200206
inputs = {key: pipeline_cfg[key]["inputs"] for key in pipeline_cfg}
201207

208+
np = importlib.import_module(f".{request.param}", package="simcore_sdk")
209+
202210
async def _create(
203211
tasks: Dict[str, Any],
204212
dag: Dict[str, List[str]],
@@ -233,15 +241,15 @@ async def _create(
233241
):
234242
# update the files in mock_dir to S3
235243
# FIXME: node_ports config shall not global! here making a hack so it works
236-
node_ports_v2.node_config.USER_ID = user_id
237-
node_ports_v2.node_config.PROJECT_ID = project_id
238-
node_ports_v2.node_config.NODE_UUID = node_uuid
244+
np.node_config.USER_ID = user_id
245+
np.node_config.PROJECT_ID = project_id
246+
np.node_config.NODE_UUID = node_uuid
239247

240248
print("--" * 10)
241-
print_module_variables(module=node_ports_v2.node_config)
249+
print_module_variables(module=np.node_config)
242250
print("--" * 10)
243251

244-
PORTS = await node_ports_v2.ports()
252+
PORTS = await np.ports()
245253
await (await PORTS.inputs)[input_key].set(
246254
mock_dir / node_inputs[input_key]["path"]
247255
)
@@ -254,29 +262,50 @@ async def _create(
254262
"itisfoundation/sleeper",
255263
"1.0.0",
256264
{
257-
"node_1": {
258-
"next": ["node_2", "node_3"],
265+
"a13d197a-bf8c-4e11-8a15-44a9894cbbe8": {
266+
"next": [
267+
"28bf052a-5fb8-4935-9c97-2b15109632b9",
268+
"dfdc165b-a10d-4049-bf4e-555bf5e7d557",
269+
],
259270
"inputs": {},
260271
},
261-
"node_2": {
262-
"next": ["node_4"],
272+
"28bf052a-5fb8-4935-9c97-2b15109632b9": {
273+
"next": ["54901e30-6cd2-417b-aaf9-b458022639d2"],
263274
"inputs": {
264-
"in_1": {"nodeUuid": "node_1", "output": "out_1"},
265-
"in_2": {"nodeUuid": "node_1", "output": "out_2"},
275+
"in_1": {
276+
"nodeUuid": "a13d197a-bf8c-4e11-8a15-44a9894cbbe8",
277+
"output": "out_1",
278+
},
279+
"in_2": {
280+
"nodeUuid": "a13d197a-bf8c-4e11-8a15-44a9894cbbe8",
281+
"output": "out_2",
282+
},
266283
},
267284
},
268-
"node_3": {
269-
"next": ["node_4"],
285+
"dfdc165b-a10d-4049-bf4e-555bf5e7d557": {
286+
"next": ["54901e30-6cd2-417b-aaf9-b458022639d2"],
270287
"inputs": {
271-
"in_1": {"nodeUuid": "node_1", "output": "out_1"},
272-
"in_2": {"nodeUuid": "node_1", "output": "out_2"},
288+
"in_1": {
289+
"nodeUuid": "a13d197a-bf8c-4e11-8a15-44a9894cbbe8",
290+
"output": "out_1",
291+
},
292+
"in_2": {
293+
"nodeUuid": "a13d197a-bf8c-4e11-8a15-44a9894cbbe8",
294+
"output": "out_2",
295+
},
273296
},
274297
},
275-
"node_4": {
298+
"54901e30-6cd2-417b-aaf9-b458022639d2": {
276299
"next": [],
277300
"inputs": {
278-
"in_1": {"nodeUuid": "node_2", "output": "out_1"},
279-
"in_2": {"nodeUuid": "node_3", "output": "out_2"},
301+
"in_1": {
302+
"nodeUuid": "28bf052a-5fb8-4935-9c97-2b15109632b9",
303+
"output": "out_1",
304+
},
305+
"in_2": {
306+
"nodeUuid": "dfdc165b-a10d-4049-bf4e-555bf5e7d557",
307+
"output": "out_2",
308+
},
280309
},
281310
},
282311
},
@@ -286,25 +315,28 @@ async def _create(
286315
"itisfoundation/osparc-python-runner",
287316
"1.0.0",
288317
{
289-
"node_1": {
290-
"next": ["node_2", "node_3"],
318+
"a13d197a-bf8c-4e11-8a15-44a9894cbbe8": {
319+
"next": [
320+
"28bf052a-5fb8-4935-9c97-2b15109632b9",
321+
"dfdc165b-a10d-4049-bf4e-555bf5e7d557",
322+
],
291323
"inputs": {
292324
"input_1": {"store": SIMCORE_S3_ID, "path": "osparc_python_sample.py"}
293325
},
294326
},
295-
"node_2": {
296-
"next": ["node_4"],
327+
"28bf052a-5fb8-4935-9c97-2b15109632b9": {
328+
"next": ["54901e30-6cd2-417b-aaf9-b458022639d2"],
297329
"inputs": {
298330
"input_1": {"store": SIMCORE_S3_ID, "path": "osparc_python_sample.py"}
299331
},
300332
},
301-
"node_3": {
302-
"next": ["node_4"],
333+
"dfdc165b-a10d-4049-bf4e-555bf5e7d557": {
334+
"next": ["54901e30-6cd2-417b-aaf9-b458022639d2"],
303335
"inputs": {
304336
"input_1": {"store": SIMCORE_S3_ID, "path": "osparc_python_sample.py"}
305337
},
306338
},
307-
"node_4": {
339+
"54901e30-6cd2-417b-aaf9-b458022639d2": {
308340
"next": [],
309341
"inputs": {
310342
"input_1": {"store": SIMCORE_S3_ID, "path": "osparc_python_sample.py"}
@@ -319,18 +351,21 @@ async def _create(
319351
"itisfoundation/osparc-python-runner",
320352
"1.0.0",
321353
{
322-
"node_1": {
354+
"a13d197a-bf8c-4e11-8a15-44a9894cbbe8": {
323355
"next": [
324-
"node_2",
356+
"28bf052a-5fb8-4935-9c97-2b15109632b9",
325357
],
326358
"inputs": {
327359
"input_1": {"store": SIMCORE_S3_ID, "path": "osparc_python_factory.py"}
328360
},
329361
},
330-
"node_2": {
362+
"28bf052a-5fb8-4935-9c97-2b15109632b9": {
331363
"next": [],
332364
"inputs": {
333-
"input_1": {"nodeUuid": "node_1", "output": "output_1"},
365+
"input_1": {
366+
"nodeUuid": "a13d197a-bf8c-4e11-8a15-44a9894cbbe8",
367+
"output": "output_1",
368+
},
334369
},
335370
},
336371
},

0 commit comments

Comments
 (0)