From ee2fc38ac2dfcce05d1a48ed5c916a1262b2cec0 Mon Sep 17 00:00:00 2001 From: b0lle <26822719+b0lle@users.noreply.github.com> Date: Tue, 6 Jan 2026 14:49:32 +0100 Subject: [PATCH] fix(make-cluster): accept custom tags for single-nodes --- src/databricks/labs/pytester/fixtures/compute.py | 2 +- tests/integration/fixtures/test_compute.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/databricks/labs/pytester/fixtures/compute.py b/src/databricks/labs/pytester/fixtures/compute.py index cfefc31..90988ad 100644 --- a/src/databricks/labs/pytester/fixtures/compute.py +++ b/src/databricks/labs/pytester/fixtures/compute.py @@ -104,7 +104,7 @@ def create( } else: kwargs["spark_conf"] = {"spark.databricks.cluster.profile": "singleNode", "spark.master": "local[*]"} - kwargs["custom_tags"] = {"ResourceClass": "SingleNode"} + kwargs["custom_tags"] = kwargs.get("custom_tags", {}) | {"ResourceClass": "SingleNode"} if "instance_pool_id" not in kwargs: kwargs["node_type_id"] = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16) if "custom_tags" not in kwargs: diff --git a/tests/integration/fixtures/test_compute.py b/tests/integration/fixtures/test_compute.py index d7ca52a..2967333 100644 --- a/tests/integration/fixtures/test_compute.py +++ b/tests/integration/fixtures/test_compute.py @@ -18,6 +18,17 @@ def test_cluster(make_cluster, env_or_skip): logger.info(f"created {make_cluster(single_node=True, instance_pool_id=env_or_skip('TEST_INSTANCE_POOL_ID'))}") +def test_cluster_custom_tags(make_cluster, env_or_skip): + cluster = make_cluster( + single_node=True, + instance_pool_id=env_or_skip('TEST_INSTANCE_POOL_ID'), + tags=[EndpointTagPair(key='my-custom-tag', value='my-custom-tag-value')], + ) + cluster_tags = cluster.tags.as_dict() + assert isinstance(cluster_tags, dict) + assert cluster_tags["custom_tags"][1]["key"] == "my-custom-tag" + + def test_instance_pool(make_instance_pool): logger.info(f"created {make_instance_pool()}")