Skip to content

Commit 0e7b39b

Browse files
committed
fix(make-cluster): accept custom tags for single-nodes
1 parent 64fb32f commit 0e7b39b

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/databricks/labs/pytester/fixtures/compute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def create(
104104
}
105105
else:
106106
kwargs["spark_conf"] = {"spark.databricks.cluster.profile": "singleNode", "spark.master": "local[*]"}
107-
kwargs["custom_tags"] = {"ResourceClass": "SingleNode"}
107+
kwargs["custom_tags"] = kwargs.get("custom_tags", {}) | {"ResourceClass": "SingleNode"}
108108
if "instance_pool_id" not in kwargs:
109109
kwargs["node_type_id"] = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16)
110110
if "custom_tags" not in kwargs:

tests/integration/fixtures/test_compute.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ def test_cluster(make_cluster, env_or_skip):
1818
logger.info(f"created {make_cluster(single_node=True, instance_pool_id=env_or_skip('TEST_INSTANCE_POOL_ID'))}")
1919

2020

21+
def test_cluster_custom_tags(make_cluster, env_or_skip):
22+
cluster = make_cluster(
23+
single_node=True,
24+
instance_pool_id=env_or_skip('TEST_INSTANCE_POOL_ID'),
25+
tags=[EndpointTagPair(key='my-custom-tag', value='my-custom-tag-value')],
26+
)
27+
cluster_tags = cluster.tags.as_dict()
28+
assert isinstance(cluster_tags, dict)
29+
assert cluster_tags["custom_tags"][1]["key"] == "my-custom-tag"
30+
31+
2132
def test_instance_pool(make_instance_pool):
2233
logger.info(f"created {make_instance_pool()}")
2334

0 commit comments

Comments
 (0)