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()}")