Skip to content

Commit

Permalink
Test the percentage migration readiness query
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Oct 28, 2024
1 parent 6722b47 commit 897c61d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/integration/queries/test_migration_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from databricks.sdk.service.catalog import SchemaInfo
from databricks.sdk import WorkspaceClient
from databricks.labs.blueprint.wheels import find_project_root
from databricks.labs.lsql.backends import SqlBackend, Row
from databricks.labs.lsql.dashboards import DashboardMetadata, Dashboards

from databricks.labs.ucx.progress.install import Historical
Expand All @@ -22,7 +23,7 @@ def tables() -> list[Table]:


@pytest.fixture
def schema_populated(ws: WorkspaceClient, sql_backend, make_catalog, make_schema, tables) -> SchemaInfo:
def schema_populated(ws: WorkspaceClient, sql_backend: SqlBackend, make_catalog, make_schema, tables) -> SchemaInfo:
# Different to the other dashboards, the migration process dashboard uses data from a UC catalog,
# not from the Hive metastore
catalog = make_catalog()
Expand Down Expand Up @@ -57,6 +58,7 @@ def dashboard_metadata(schema_populated: SchemaInfo) -> DashboardMetadata:
dashboard_metadata = DashboardMetadata.from_path(migration_progress_dashboard_path).replace_database(
database=schema_populated.full_name, database_to_replace="inventory"
)
dashboard_metadata.validate()
return dashboard_metadata


Expand All @@ -79,3 +81,13 @@ def test_migration_progress_dashboard(
dashboard_url = f"{ws.config.host}/sql/dashboardsv3/{dashboard.dashboard_id}"
webbrowser.open(dashboard_url)
assert True, "Dashboard deployment successful"


def test_percentage_migration_readiness(dashboard_metadata: DashboardMetadata, sql_backend: SqlBackend) -> None:
query_name = "01_0_percentage_migration_readiness"
datasets = [d for d in dashboard_metadata.get_datasets() if d.name == query_name]
assert len(datasets) == 1, f"Missing query: {query_name}"
query_results = list(sql_backend.fetch(datasets[0].query))
assert query_results == [
Row(percentage=100.0)
]

0 comments on commit 897c61d

Please sign in to comment.