Skip to content

Commit

Permalink
Test valid migration progress prerequisites
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Oct 8, 2024
1 parent f1ddb60 commit 1fa15f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit/progress/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pytest
from databricks.sdk import WorkspaceClient
from databricks.sdk.errors import PermissionDenied
from databricks.sdk.service.catalog import CatalogInfo, MetastoreAssignment
from databricks.sdk.service.jobs import BaseRun, RunResultState, RunState

from databricks.labs.ucx.assessment.clusters import ClustersCrawler, PoliciesCrawler
from databricks.labs.ucx.assessment.jobs import JobsCrawler
Expand Down Expand Up @@ -39,6 +41,20 @@ def test_migration_progress_runtime_refresh(run_workflow, task, crawler, crawler
mock_crawler.snapshot.assert_called_once_with(force_refresh=True)


def test_migration_progress_with_valid_prerequisites(run_workflow) -> None:
ws = create_autospec(WorkspaceClient)
ws.metastores.current.return_value = MetastoreAssignment(metastore_id="test", workspace_id=123456789)
ws.catalogs.get.return_value = CatalogInfo()
ws.jobs.list_runs.return_value = [BaseRun(state=RunState(result_state=RunResultState.SUCCESS))]
task = MigrationProgress.verify_prerequisites
try:
run_workflow(task, workspace_client=ws)
except RuntimeError as e:
assert False, f"{task} raise error: {e}"
else:
assert True, "Valid prerequisites found"


def test_migration_progress_raises_runtime_error_if_metastore_not_attached_to_workflow(run_workflow) -> None:
ws = create_autospec(WorkspaceClient)
ws.metastores.current.return_value = None
Expand Down

0 comments on commit 1fa15f5

Please sign in to comment.