Skip to content

Commit

Permalink
Added Multi Failure Test
Browse files Browse the repository at this point in the history
  • Loading branch information
FastLee committed Jan 22, 2024
1 parent 38256dc commit a61eb09
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion tests/unit/assessment/test_clusters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest.mock import Mock
from unittest.mock import Mock, create_autospec

import pytest
from databricks.sdk import WorkspaceClient
from databricks.sdk.errors import DatabricksError, InternalError, NotFound
from databricks.sdk.service.compute import (
AutoScale,
Expand Down Expand Up @@ -421,3 +422,35 @@ def test_cluster_without_owner_should_have_empty_creator_name(mocker):
failures="[]",
)
]


def test_cluster_with_multiple_failures():
sample_clusters = [
ClusterDetails(
autoscale=AutoScale(min_workers=1, max_workers=6),
cluster_source=ClusterSource.UI,
spark_context_id=5134472582179565315,
spark_conf={
"spark.databricks.passthrough.enabled":"True"
},
spark_env_vars=None,
spark_version="9.3.x-cpu-ml-scala2.12",
cluster_id="0810-225833-atlanta69",
cluster_name="Tech Summit FY24 Cluster-1",
)
]
ws = create_autospec(WorkspaceClient)
mockbackend = MockBackend()

ws.clusters.list.return_value = sample_clusters
ClustersCrawler(ws, mockbackend, "ucx").snapshot()
result = mockbackend.rows_written_for("hive_metastore.ucx.clusters", "append")
assert result == [
ClusterInfo(
cluster_id="0810-225833-atlanta69",
cluster_name="Tech Summit FY24 Cluster-1",
creator=None,
success=0,
failures='["not supported DBR: 9.3.x-cpu-ml-scala2.12", "unsupported config: spark.databricks.passthrough.enabled"]'
)
]

0 comments on commit a61eb09

Please sign in to comment.