Skip to content

Commit 5c9e2c2

Browse files
fix tests
1 parent 20ec910 commit 5c9e2c2

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

services/director-v2/tests/integration/01/test_computation_api.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def fake_workbench_computational_pipeline_details_not_started(
150150
"user_id": "some invalid id",
151151
"project_id": "not a uuid",
152152
"product_name": "not a product",
153+
"product_api_base_url": "http://invalid",
153154
},
154155
status.HTTP_422_UNPROCESSABLE_ENTITY,
155156
),
@@ -158,6 +159,7 @@ def fake_workbench_computational_pipeline_details_not_started(
158159
"user_id": 2,
159160
"project_id": "not a uuid",
160161
"product_name": "not a product",
162+
"product_api_base_url": "http://invalid",
161163
},
162164
status.HTTP_422_UNPROCESSABLE_ENTITY,
163165
),
@@ -166,6 +168,7 @@ def fake_workbench_computational_pipeline_details_not_started(
166168
"user_id": 3,
167169
"project_id": "16e60a5d-834e-4267-b44d-3af49171bf21",
168170
"product_name": "not a product",
171+
"product_api_base_url": "http://invalid",
169172
},
170173
status.HTTP_404_NOT_FOUND,
171174
),
@@ -191,6 +194,7 @@ async def test_start_empty_computation_is_refused(
191194
registered_user: Callable,
192195
project: Callable[..., Awaitable[ProjectAtDB]],
193196
osparc_product_name: str,
197+
osparc_product_api_base_url: str,
194198
create_pipeline: Callable[..., Awaitable[ComputationGet]],
195199
):
196200
user = registered_user()
@@ -204,6 +208,7 @@ async def test_start_empty_computation_is_refused(
204208
user_id=user["id"],
205209
start_pipeline=True,
206210
product_name=osparc_product_name,
211+
product_api_base_url=osparc_product_api_base_url,
207212
)
208213

209214

@@ -397,6 +402,7 @@ async def test_run_partial_computation(
397402
fake_workbench_without_outputs: dict[str, Any],
398403
params: PartialComputationParams,
399404
osparc_product_name: str,
405+
osparc_product_api_base_url: str,
400406
create_pipeline: Callable[..., Awaitable[ComputationGet]],
401407
):
402408
user = registered_user()
@@ -449,6 +455,7 @@ def _convert_to_pipeline_details(
449455
user_id=user["id"],
450456
start_pipeline=True,
451457
product_name=osparc_product_name,
458+
product_api_base_url=osparc_product_api_base_url,
452459
subgraph=[
453460
str(node_id)
454461
for index, node_id in enumerate(sleepers_project.workbench)
@@ -492,6 +499,7 @@ def _convert_to_pipeline_details(
492499
user_id=user["id"],
493500
start_pipeline=True,
494501
product_name=osparc_product_name,
502+
product_api_base_url=osparc_product_api_base_url,
495503
expected_response_status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
496504
subgraph=[
497505
str(node_id)
@@ -513,6 +521,7 @@ def _convert_to_pipeline_details(
513521
user_id=user["id"],
514522
start_pipeline=True,
515523
product_name=osparc_product_name,
524+
product_api_base_url=osparc_product_api_base_url,
516525
expected_response_status_code=status.HTTP_201_CREATED,
517526
subgraph=[
518527
str(node_id)
@@ -546,6 +555,7 @@ async def test_run_computation(
546555
fake_workbench_computational_pipeline_details: PipelineDetails,
547556
fake_workbench_computational_pipeline_details_completed: PipelineDetails,
548557
osparc_product_name: str,
558+
osparc_product_api_base_url: str,
549559
create_pipeline: Callable[..., Awaitable[ComputationGet]],
550560
):
551561
user = registered_user()
@@ -558,6 +568,7 @@ async def test_run_computation(
558568
user_id=user["id"],
559569
start_pipeline=True,
560570
product_name=osparc_product_name,
571+
product_api_base_url=osparc_product_api_base_url,
561572
expected_response_status_code=status.HTTP_201_CREATED,
562573
)
563574

@@ -604,6 +615,7 @@ async def test_run_computation(
604615
user_id=user["id"],
605616
start_pipeline=True,
606617
product_name=osparc_product_name,
618+
product_api_base_url=osparc_product_api_base_url,
607619
)
608620

609621
# now force run again
@@ -627,6 +639,7 @@ async def test_run_computation(
627639
user_id=user["id"],
628640
start_pipeline=True,
629641
product_name=osparc_product_name,
642+
product_api_base_url=osparc_product_api_base_url,
630643
force_restart=True,
631644
)
632645
# check the contents is correct
@@ -658,6 +671,7 @@ async def test_abort_computation(
658671
fake_workbench_without_outputs: dict[str, Any],
659672
fake_workbench_computational_pipeline_details: PipelineDetails,
660673
osparc_product_name: str,
674+
osparc_product_api_base_url: str,
661675
create_pipeline: Callable[..., Awaitable[ComputationGet]],
662676
):
663677
user = registered_user()
@@ -675,6 +689,7 @@ async def test_abort_computation(
675689
user_id=user["id"],
676690
start_pipeline=True,
677691
product_name=osparc_product_name,
692+
product_api_base_url=osparc_product_api_base_url,
678693
)
679694

680695
# check the contents is correctb
@@ -736,6 +751,7 @@ async def test_update_and_delete_computation(
736751
fake_workbench_computational_pipeline_details_not_started: PipelineDetails,
737752
fake_workbench_computational_pipeline_details: PipelineDetails,
738753
osparc_product_name: str,
754+
osparc_product_api_base_url: str,
739755
create_pipeline: Callable[..., Awaitable[ComputationGet]],
740756
):
741757
user = registered_user()
@@ -747,6 +763,7 @@ async def test_update_and_delete_computation(
747763
user_id=user["id"],
748764
start_pipeline=False,
749765
product_name=osparc_product_name,
766+
product_api_base_url=osparc_product_api_base_url,
750767
)
751768

752769
# check the contents is correctb
@@ -765,6 +782,7 @@ async def test_update_and_delete_computation(
765782
user_id=user["id"],
766783
start_pipeline=False,
767784
product_name=osparc_product_name,
785+
product_api_base_url=osparc_product_api_base_url,
768786
)
769787

770788
# check the contents is correctb
@@ -783,6 +801,7 @@ async def test_update_and_delete_computation(
783801
user_id=user["id"],
784802
start_pipeline=False,
785803
product_name=osparc_product_name,
804+
product_api_base_url=osparc_product_api_base_url,
786805
)
787806

788807
# check the contents is correctb
@@ -801,6 +820,7 @@ async def test_update_and_delete_computation(
801820
user_id=user["id"],
802821
start_pipeline=True,
803822
product_name=osparc_product_name,
823+
product_api_base_url=osparc_product_api_base_url,
804824
)
805825
# check the contents is correctb
806826
await assert_computation_task_out_obj(
@@ -831,6 +851,7 @@ async def test_update_and_delete_computation(
831851
user_id=user["id"],
832852
start_pipeline=False,
833853
product_name=osparc_product_name,
854+
product_api_base_url=osparc_product_api_base_url,
834855
)
835856

836857
# try to delete the pipeline, is expected to be forbidden if force parameter is false (default)
@@ -856,6 +877,7 @@ async def test_pipeline_with_no_computational_services_still_create_correct_comp
856877
project: Callable[..., Awaitable[ProjectAtDB]],
857878
jupyter_service: dict[str, Any],
858879
osparc_product_name: str,
880+
osparc_product_api_base_url: str,
859881
create_pipeline: Callable[..., Awaitable[ComputationGet]],
860882
):
861883
user = registered_user()
@@ -881,6 +903,7 @@ async def test_pipeline_with_no_computational_services_still_create_correct_comp
881903
user_id=user["id"],
882904
start_pipeline=True,
883905
product_name=osparc_product_name,
906+
product_api_base_url=osparc_product_api_base_url,
884907
)
885908

886909
# still this pipeline shall be createable if we do not want to start it
@@ -890,6 +913,7 @@ async def test_pipeline_with_no_computational_services_still_create_correct_comp
890913
user_id=user["id"],
891914
start_pipeline=False,
892915
product_name=osparc_product_name,
916+
product_api_base_url=osparc_product_api_base_url,
893917
)
894918

895919

@@ -899,6 +923,7 @@ async def test_pipeline_with_control_loop_made_of_dynamic_services_is_allowed(
899923
project: Callable[..., Awaitable[ProjectAtDB]],
900924
jupyter_service: dict[str, Any],
901925
osparc_product_name: str,
926+
osparc_product_api_base_url: str,
902927
):
903928
user = registered_user()
904929
# create a workbench with just 2 dynamic service in a cycle
@@ -940,6 +965,7 @@ async def test_pipeline_with_control_loop_made_of_dynamic_services_is_allowed(
940965
"project_id": str(project_with_dynamic_node.uuid),
941966
"start_pipeline": True,
942967
"product_name": osparc_product_name,
968+
"product_api_base_url": osparc_product_api_base_url,
943969
},
944970
)
945971
assert (
@@ -954,6 +980,7 @@ async def test_pipeline_with_control_loop_made_of_dynamic_services_is_allowed(
954980
"project_id": str(project_with_dynamic_node.uuid),
955981
"start_pipeline": False,
956982
"product_name": osparc_product_name,
983+
"product_api_base_url": osparc_product_api_base_url,
957984
},
958985
)
959986
assert (
@@ -968,6 +995,7 @@ async def test_pipeline_with_cycle_containing_a_computational_service_is_forbidd
968995
sleeper_service: dict[str, Any],
969996
jupyter_service: dict[str, Any],
970997
osparc_product_name: str,
998+
osparc_product_api_base_url: str,
971999
):
9721000
user = registered_user()
9731001
# create a workbench with just 2 dynamic service in a cycle
@@ -1021,6 +1049,7 @@ async def test_pipeline_with_cycle_containing_a_computational_service_is_forbidd
10211049
"project_id": str(project_with_cycly_and_comp_service.uuid),
10221050
"start_pipeline": True,
10231051
"product_name": osparc_product_name,
1052+
"product_api_base_url": osparc_product_api_base_url,
10241053
},
10251054
)
10261055
assert (
@@ -1035,6 +1064,7 @@ async def test_pipeline_with_cycle_containing_a_computational_service_is_forbidd
10351064
"project_id": str(project_with_cycly_and_comp_service.uuid),
10361065
"start_pipeline": False,
10371066
"product_name": osparc_product_name,
1067+
"product_api_base_url": osparc_product_api_base_url,
10381068
},
10391069
)
10401070
assert (

services/director-v2/tests/integration/02/test_dynamic_sidecar_nodeports_integration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ async def test_nodeports_integration(
902902
fake_dy_success: dict[str, Any],
903903
tmp_path: Path,
904904
osparc_product_name: str,
905+
osparc_product_api_url: str,
905906
create_pipeline: Callable[..., Awaitable[ComputationGet]],
906907
mock_io_log_redirect_cb: LogRedirectCB,
907908
faker: Faker,
@@ -952,6 +953,7 @@ async def test_nodeports_integration(
952953
user_id=current_user["id"],
953954
start_pipeline=True,
954955
product_name=osparc_product_name,
956+
product_api_url=osparc_product_api_url,
955957
)
956958

957959
# wait for the computation to finish (either by failing, success or abort)

services/director-v2/tests/integration/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ def osparc_product_name() -> str:
6767
return "osparc"
6868

6969

70+
@pytest.fixture(scope="session")
71+
def osparc_product_api_base_url() -> str:
72+
return "https://api.osparc.io"
73+
74+
7075
COMPUTATION_URL: str = "v2/computations"
7176

7277

@@ -82,6 +87,7 @@ async def _creator(
8287
project: ProjectAtDB,
8388
user_id: UserID,
8489
product_name: str,
90+
product_api_base_url: str,
8591
start_pipeline: bool,
8692
**kwargs,
8793
) -> ComputationGet:
@@ -92,6 +98,7 @@ async def _creator(
9298
"project_id": str(project.uuid),
9399
"start_pipeline": start_pipeline,
94100
"product_name": product_name,
101+
"product_api_base_url": product_api_base_url,
95102
**kwargs,
96103
},
97104
)

0 commit comments

Comments
 (0)