diff --git a/dask_kubernetes/experimental/tests/test_kubecluster.py b/dask_kubernetes/experimental/tests/test_kubecluster.py index 742b59c80..eda01110b 100644 --- a/dask_kubernetes/experimental/tests/test_kubecluster.py +++ b/dask_kubernetes/experimental/tests/test_kubecluster.py @@ -39,6 +39,17 @@ def test_multiple_clusters_simultaneously(kopf_runner, docker_image): assert client2.submit(lambda x: x + 1, 10).result() == 11 +def test_multiple_clusters_simultaneously_same_loop(kopf_runner, docker_image): + with kopf_runner: + with KubeCluster(name="fizz", image=docker_image) as cluster1, KubeCluster( + name="buzz", image=docker_image, loop=cluster1.loop + ) as cluster2: + with Client(cluster1) as client1, Client(cluster2) as client2: + assert cluster1.loop is cluster2.loop is client1.loop is client2.loop + assert client1.submit(lambda x: x + 1, 10).result() == 11 + assert client2.submit(lambda x: x + 1, 10).result() == 11 + + def test_cluster_from_name(kopf_runner, docker_image): with kopf_runner: with KubeCluster(name="abc", image=docker_image) as firstcluster: