Skip to content

Commit 5246d30

Browse files
committed
test fixed
1 parent ed6fde6 commit 5246d30

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ async def test_pipeline_with_on_demand_cluster_with_not_ready_backend_waits(
20482048
"get_or_create_exception",
20492049
[ClustersKeeperNotAvailableError],
20502050
)
2051-
async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_fails(
2051+
async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_waits(
20522052
with_disabled_auto_scheduling: mock.Mock,
20532053
with_disabled_scheduler_publisher: mock.Mock,
20542054
initialized_app: FastAPI,
@@ -2100,8 +2100,8 @@ async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_fails(
21002100
expected_progress=None,
21012101
run_id=run_in_db.run_id,
21022102
)
2103-
# now it should switch to failed, the run still runs until the next iteration
2104-
expected_failed_tasks = [
2103+
# now it should switch to waiting for cluster and waits
2104+
expected_waiting_for_cluster_tasks = [
21052105
published_project.tasks[1],
21062106
published_project.tasks[3],
21072107
]
@@ -2116,7 +2116,7 @@ async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_fails(
21162116
await assert_comp_runs(
21172117
sqlalchemy_async_engine,
21182118
expected_total=1,
2119-
expected_state=RunningState.FAILED,
2119+
expected_state=RunningState.WAITING_FOR_CLUSTER,
21202120
where_statement=and_(
21212121
comp_runs.c.user_id == published_project.project.prj_owner,
21222122
comp_runs.c.project_uuid == f"{published_project.project.uuid}",
@@ -2130,22 +2130,24 @@ async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_fails(
21302130
await assert_comp_tasks_and_comp_run_snapshot_tasks(
21312131
sqlalchemy_async_engine,
21322132
project_uuid=published_project.project.uuid,
2133-
task_ids=[t.node_id for t in expected_failed_tasks],
2134-
expected_state=RunningState.FAILED,
2135-
expected_progress=1.0,
2133+
task_ids=[t.node_id for t in expected_waiting_for_cluster_tasks],
2134+
expected_state=RunningState.WAITING_FOR_CLUSTER,
2135+
expected_progress=None,
21362136
run_id=run_in_db.run_id,
21372137
)
2138-
# again will not re-trigger the call to clusters-keeper
2138+
# again will trigger the call again
21392139
await scheduler_api.apply(
21402140
user_id=run_in_db.user_id,
21412141
project_id=run_in_db.project_uuid,
21422142
iteration=run_in_db.iteration,
21432143
)
2144-
mocked_get_or_create_cluster.assert_not_called()
2144+
mocked_get_or_create_cluster.assert_called()
2145+
assert mocked_get_or_create_cluster.call_count == 1
2146+
mocked_get_or_create_cluster.reset_mock()
21452147
await assert_comp_runs(
21462148
sqlalchemy_async_engine,
21472149
expected_total=1,
2148-
expected_state=RunningState.FAILED,
2150+
expected_state=RunningState.WAITING_FOR_CLUSTER,
21492151
where_statement=and_(
21502152
comp_runs.c.user_id == published_project.project.prj_owner,
21512153
comp_runs.c.project_uuid == f"{published_project.project.uuid}",
@@ -2159,9 +2161,9 @@ async def test_pipeline_with_on_demand_cluster_with_no_clusters_keeper_fails(
21592161
await assert_comp_tasks_and_comp_run_snapshot_tasks(
21602162
sqlalchemy_async_engine,
21612163
project_uuid=published_project.project.uuid,
2162-
task_ids=[t.node_id for t in expected_failed_tasks],
2163-
expected_state=RunningState.FAILED,
2164-
expected_progress=1.0,
2164+
task_ids=[t.node_id for t in expected_waiting_for_cluster_tasks],
2165+
expected_state=RunningState.WAITING_FOR_CLUSTER,
2166+
expected_progress=None,
21652167
run_id=run_in_db.run_id,
21662168
)
21672169

0 commit comments

Comments
 (0)