Skip to content

Commit 3c5cbb8

Browse files
fix
1 parent 4692f78 commit 3c5cbb8

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ async def test_computation_create_validators(
377377
product_name: str,
378378
product_api_base_url: AnyHttpUrl,
379379
with_product: dict[str, Any],
380-
faker_collection_run_id: CollectionRunID,
380+
fake_collection_run_id: CollectionRunID,
381381
):
382382
user = create_registered_user()
383383
proj = await create_project(user, workbench=fake_workbench_without_outputs)
@@ -387,15 +387,15 @@ async def test_computation_create_validators(
387387
product_name=product_name,
388388
product_api_base_url=product_api_base_url,
389389
use_on_demand_clusters=True,
390-
collection_run_id=faker_collection_run_id,
390+
collection_run_id=fake_collection_run_id,
391391
)
392392
ComputationCreate(
393393
user_id=user["id"],
394394
project_id=proj.uuid,
395395
product_name=product_name,
396396
product_api_base_url=product_api_base_url,
397397
use_on_demand_clusters=False,
398-
collection_run_id=faker_collection_run_id,
398+
collection_run_id=fake_collection_run_id,
399399
)
400400

401401

@@ -409,7 +409,7 @@ async def test_create_computation(
409409
create_registered_user: Callable[..., dict[str, Any]],
410410
create_project: Callable[..., Awaitable[ProjectAtDB]],
411411
async_client: httpx.AsyncClient,
412-
faker_collection_run_id: CollectionRunID,
412+
fake_collection_run_id: CollectionRunID,
413413
):
414414
user = create_registered_user()
415415
proj = await create_project(user, workbench=fake_workbench_without_outputs)
@@ -422,7 +422,7 @@ async def test_create_computation(
422422
project_id=proj.uuid,
423423
product_name=product_name,
424424
product_api_base_url=product_api_base_url,
425-
collection_run_id=faker_collection_run_id,
425+
collection_run_id=fake_collection_run_id,
426426
)
427427
),
428428
)
@@ -518,7 +518,7 @@ async def test_create_computation_with_wallet(
518518
sqlalchemy_async_engine: AsyncEngine,
519519
fake_ec2_cpus: PositiveInt,
520520
fake_ec2_ram: ByteSize,
521-
faker_collection_run_id: CollectionRunID,
521+
fake_collection_run_id: CollectionRunID,
522522
):
523523
# In billable product a wallet is passed, with a selected pricing plan
524524
# the pricing plan contains information about the hardware that should be used
@@ -540,7 +540,7 @@ async def test_create_computation_with_wallet(
540540
product_name=product_name,
541541
product_api_base_url=product_api_base_url,
542542
wallet_info=wallet_info,
543-
collection_run_id=faker_collection_run_id,
543+
collection_run_id=fake_collection_run_id,
544544
)
545545
),
546546
)
@@ -627,7 +627,7 @@ async def test_create_computation_with_wallet_with_invalid_pricing_unit_name_rai
627627
create_project: Callable[..., Awaitable[ProjectAtDB]],
628628
async_client: httpx.AsyncClient,
629629
wallet_info: WalletInfo,
630-
faker_collection_run_id: CollectionRunID,
630+
fake_collection_run_id: CollectionRunID,
631631
):
632632
user = create_registered_user()
633633
proj = await create_project(
@@ -644,7 +644,7 @@ async def test_create_computation_with_wallet_with_invalid_pricing_unit_name_rai
644644
product_name=product_name,
645645
product_api_base_url=product_api_base_url,
646646
wallet_info=wallet_info,
647-
collection_run_id=faker_collection_run_id,
647+
collection_run_id=fake_collection_run_id,
648648
)
649649
),
650650
)
@@ -672,7 +672,7 @@ async def test_create_computation_with_wallet_with_no_clusters_keeper_raises_503
672672
create_project: Callable[..., Awaitable[ProjectAtDB]],
673673
async_client: httpx.AsyncClient,
674674
wallet_info: WalletInfo,
675-
faker_collection_run_id: CollectionRunID,
675+
fake_collection_run_id: CollectionRunID,
676676
):
677677
user = create_registered_user()
678678
proj = await create_project(user, workbench=fake_workbench_without_outputs)
@@ -686,7 +686,7 @@ async def test_create_computation_with_wallet_with_no_clusters_keeper_raises_503
686686
product_name=product_name,
687687
product_api_base_url=product_api_base_url,
688688
wallet_info=wallet_info,
689-
collection_run_id=faker_collection_run_id,
689+
collection_run_id=fake_collection_run_id,
690690
)
691691
),
692692
)
@@ -727,7 +727,7 @@ async def test_start_computation(
727727
create_registered_user: Callable[..., dict[str, Any]],
728728
create_project: Callable[..., Awaitable[ProjectAtDB]],
729729
async_client: httpx.AsyncClient,
730-
faker_collection_run_id: CollectionRunID,
730+
fake_collection_run_id: CollectionRunID,
731731
):
732732
user = create_registered_user()
733733
proj = await create_project(user, workbench=fake_workbench_without_outputs)
@@ -741,7 +741,7 @@ async def test_start_computation(
741741
start_pipeline=True,
742742
product_name=product_name,
743743
product_api_base_url=product_api_base_url,
744-
collection_run_id=faker_collection_run_id,
744+
collection_run_id=fake_collection_run_id,
745745
)
746746
),
747747
)
@@ -813,7 +813,7 @@ async def test_start_computation_with_deprecated_services_raises_406(
813813
create_registered_user: Callable[..., dict[str, Any]],
814814
create_project: Callable[..., Awaitable[ProjectAtDB]],
815815
async_client: httpx.AsyncClient,
816-
faker_collection_run_id: CollectionRunID,
816+
fake_collection_run_id: CollectionRunID,
817817
):
818818
user = create_registered_user()
819819
proj = await create_project(user, workbench=fake_workbench_without_outputs)
@@ -827,7 +827,7 @@ async def test_start_computation_with_deprecated_services_raises_406(
827827
start_pipeline=True,
828828
product_name=product_name,
829829
product_api_base_url=product_api_base_url,
830-
collection_run_id=faker_collection_run_id,
830+
collection_run_id=fake_collection_run_id,
831831
)
832832
),
833833
)

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_rpc_computations.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,19 +239,21 @@ async def test_rpc_list_computation_collection_runs_page_and_collection_run_task
239239
fake_workbench_without_outputs: dict[str, Any], # <-- Has 4 nodes
240240
fake_workbench_adjacency: dict[str, Any],
241241
create_registered_user: Callable[..., dict[str, Any]],
242-
project: Callable[..., Awaitable[ProjectAtDB]],
242+
create_project: Callable[..., Awaitable[ProjectAtDB]],
243243
create_pipeline: Callable[..., Awaitable[CompPipelineAtDB]],
244-
create_tasks: Callable[..., Awaitable[list[CompTaskAtDB]]],
244+
create_tasks_from_project: Callable[..., Awaitable[list[CompTaskAtDB]]],
245245
create_comp_run_snapshot_tasks: Callable[
246246
..., Awaitable[list[CompRunSnapshotTaskDBGet]]
247247
],
248248
create_comp_run: Callable[..., Awaitable[CompRunsAtDB]],
249249
rpc_client: RabbitMQRPCClient,
250250
faker: Faker,
251+
with_product: dict[str, Any],
251252
):
252253
user = create_registered_user()
253254
projects = [
254-
await project(user, workbench=fake_workbench_without_outputs) for _ in range(3)
255+
await create_project(user, workbench=fake_workbench_without_outputs)
256+
for _ in range(3)
255257
]
256258

257259
default_collection_run_id = CollectionRunID(f"{faker.uuid4(cast_to=None)}")
@@ -268,7 +270,7 @@ async def test_rpc_list_computation_collection_runs_page_and_collection_run_task
268270
project_id=f"{proj.uuid}",
269271
dag_adjacency_list=fake_workbench_adjacency,
270272
)
271-
await create_tasks(
273+
await create_tasks_from_project(
272274
user=user, project=proj, state=StateType.PUBLISHED, progress=None
273275
)
274276
run = await create_comp_run(

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_db_repositories_comp_runs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ async def test_list_group_by_collection_run_id(
558558
faker: Faker,
559559
publish_project: Callable[[], Awaitable[PublishedProject]],
560560
fake_collection_run_id: CollectionRunID,
561+
with_product: dict[str, Any],
561562
):
562563
"""Test list_group_by_collection_run_id function with simple data insertion and retrieval."""
563564
# Create a few published projects
@@ -624,6 +625,7 @@ async def test_list_group_by_collection_run_id_with_mixed_states_returns_started
624625
faker: Faker,
625626
publish_project: Callable[[], Awaitable[PublishedProject]],
626627
fake_collection_run_id: CollectionRunID,
628+
with_product: dict[str, Any],
627629
):
628630
"""Test that if any state is not final, the grouped state returns STARTED."""
629631
# Create published projects
@@ -708,6 +710,7 @@ async def test_list_group_by_collection_run_id_all_success_returns_success(
708710
faker: Faker,
709711
publish_project: Callable[[], Awaitable[PublishedProject]],
710712
fake_collection_run_id: CollectionRunID,
713+
with_product: dict[str, Any],
711714
):
712715
"""Test that if all states are SUCCESS, the grouped state returns SUCCESS."""
713716
published_project_1 = await publish_project()
@@ -773,6 +776,7 @@ async def test_list_group_by_collection_run_id_with_failed_returns_failed(
773776
faker: Faker,
774777
publish_project: Callable[[], Awaitable[PublishedProject]],
775778
fake_collection_run_id: CollectionRunID,
779+
with_product: dict[str, Any],
776780
):
777781
"""Test that if any state is FAILED (among final states), the grouped state returns FAILED."""
778782
published_project_1 = await publish_project()
@@ -840,6 +844,7 @@ async def test_list_group_by_collection_run_id_with_aborted_returns_aborted(
840844
faker: Faker,
841845
publish_project: Callable[[], Awaitable[PublishedProject]],
842846
fake_collection_run_id: CollectionRunID,
847+
with_product: dict[str, Any],
843848
):
844849
"""Test that if any state is ABORTED (but no FAILED), the grouped state returns ABORTED."""
845850
published_project_1 = await publish_project()
@@ -905,6 +910,7 @@ async def test_list_group_by_collection_run_id_with_unknown_returns_unknown(
905910
faker: Faker,
906911
publish_project: Callable[[], Awaitable[PublishedProject]],
907912
fake_collection_run_id: CollectionRunID,
913+
with_product: dict[str, Any],
908914
):
909915
"""Test that if any state is UNKNOWN (but no FAILED/ABORTED), the grouped state returns UNKNOWN."""
910916
published_project_1 = await publish_project()
@@ -969,6 +975,7 @@ async def test_list_group_by_collection_run_id_with_project_filter(
969975
run_metadata: RunMetadataDict,
970976
faker: Faker,
971977
publish_project: Callable[[], Awaitable[PublishedProject]],
978+
with_product: dict[str, Any],
972979
):
973980
"""Test list_group_by_collection_run_id with project_ids filter."""
974981
published_project_1 = await publish_project()
@@ -1033,6 +1040,7 @@ async def test_list_group_by_collection_run_id_pagination(
10331040
run_metadata: RunMetadataDict,
10341041
faker: Faker,
10351042
publish_project: Callable[[], Awaitable[PublishedProject]],
1043+
with_product: dict[str, Any],
10361044
):
10371045
"""Test pagination functionality of list_group_by_collection_run_id."""
10381046
published_project = await publish_project()
@@ -1093,6 +1101,7 @@ async def test_list_group_by_collection_run_id_empty_result(
10931101
sqlalchemy_async_engine: AsyncEngine,
10941102
run_metadata: RunMetadataDict,
10951103
fake_user_id: UserID,
1104+
with_product: dict[str, Any],
10961105
):
10971106
"""Test list_group_by_collection_run_id returns empty when no runs exist."""
10981107
repo = CompRunsRepository(sqlalchemy_async_engine)
@@ -1114,6 +1123,7 @@ async def test_list_group_by_collection_run_id_with_different_users(
11141123
run_metadata: RunMetadataDict,
11151124
faker: Faker,
11161125
publish_project: Callable[[], Awaitable[PublishedProject]],
1126+
with_product: dict[str, Any],
11171127
):
11181128
"""Test that list_group_by_collection_run_id filters by user_id correctly."""
11191129
published_project_user1 = await publish_project()
@@ -1184,6 +1194,7 @@ async def test_list_group_by_collection_run_id_state_priority_precedence(
11841194
faker: Faker,
11851195
publish_project: Callable[[], Awaitable[PublishedProject]],
11861196
fake_collection_run_id: CollectionRunID,
1197+
with_product: dict[str, Any],
11871198
):
11881199
"""Test that state resolution follows correct priority: FAILED > ABORTED > UNKNOWN."""
11891200
published_projects = [await publish_project() for _ in range(4)]

0 commit comments

Comments
 (0)