From fb049661d6a80d9fc6ec6f81da5bdc44531bced3 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Mon, 7 Aug 2023 11:20:21 +0100 Subject: [PATCH] Fix discovery --- .../kubecluster/tests/test_discovery.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dask_kubernetes/operator/kubecluster/tests/test_discovery.py b/dask_kubernetes/operator/kubecluster/tests/test_discovery.py index 240f1d0cd..066bf7694 100644 --- a/dask_kubernetes/operator/kubecluster/tests/test_discovery.py +++ b/dask_kubernetes/operator/kubecluster/tests/test_discovery.py @@ -6,11 +6,17 @@ @pytest.mark.anyio -async def test_discovery(async_cluster): - clusters = [name async for name, _ in discover()] - assert async_cluster.name in clusters - async with KubeCluster.from_name(async_cluster.name, asynchronous=True) as cluster2: - assert async_cluster == cluster2 - assert "id" in cluster2.scheduler_info - async with Client(cluster2, asynchronous=True) as client: - assert await client.submit(lambda x: x + 1, 10).result() == 11 +async def test_discovery(kopf_runner, docker_image): + with kopf_runner: + async with KubeCluster( + image=docker_image, n_workers=1, asynchronous=True + ) as cluster: + clusters = [name async for name, _ in discover()] + assert cluster.name in clusters + async with KubeCluster.from_name( + cluster.name, asynchronous=True + ) as cluster2: + assert cluster == cluster2 + assert "id" in cluster2.scheduler_info + async with Client(cluster2, asynchronous=True) as client: + assert await client.submit(lambda x: x + 1, 10).result() == 11