Skip to content

Commit 61e68eb

Browse files
committed
added test
1 parent a3f9c98 commit 61e68eb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

services/autoscaling/tests/unit/test_modules_dask.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
add_instance_generic_resources,
3939
get_worker_still_has_results_in_memory,
4040
get_worker_used_resources,
41+
is_worker_connected,
4142
list_processing_tasks_per_worker,
4243
list_unrunnable_tasks,
4344
)
@@ -380,15 +381,16 @@ def _add_fct(x: int, y: int) -> int:
380381
[(4, 1, 4), (4, 2, 8), (0, 2.0, -1)],
381382
)
382383
def test_add_instance_generic_resources(
384+
scheduler_url: AnyUrl,
385+
scheduler_authentication: ClusterAuthentication,
383386
fake_ec2_instance_data: Callable[..., EC2InstanceData],
384-
faker: Faker,
385387
dask_nthreads: int,
386388
dask_nthreads_multiplier: int,
387389
expected_threads_resource: int,
388390
):
389391
settings = DaskMonitoringSettings(
390-
DASK_MONITORING_URL=faker.url(),
391-
DASK_SCHEDULER_AUTH=NoAuthentication(),
392+
DASK_MONITORING_URL=scheduler_url,
393+
DASK_SCHEDULER_AUTH=scheduler_authentication,
392394
DASK_NTHREADS=dask_nthreads,
393395
DASK_NTHREADS_MULTIPLIER=dask_nthreads_multiplier,
394396
)
@@ -411,3 +413,17 @@ def test_add_instance_generic_resources(
411413
ec2_instance_data.resources.generic_resources[DASK_WORKER_THREAD_RESOURCE_NAME]
412414
== expected_threads_resource
413415
)
416+
417+
418+
async def test_is_worker_connected(
419+
scheduler_url: AnyUrl,
420+
scheduler_authentication: ClusterAuthentication,
421+
fake_ec2_instance_data: Callable[..., EC2InstanceData],
422+
):
423+
ec2_instance_data = fake_ec2_instance_data()
424+
assert (
425+
await is_worker_connected(
426+
scheduler_url, scheduler_authentication, ec2_instance_data
427+
)
428+
is False
429+
)

0 commit comments

Comments
 (0)