Skip to content

Commit 966fc75

Browse files
authored
Install state misses dashboards fields (#2275)
## Changes Save installation at the end of the `WorkspaceInstallation.run`. This bug was silently introduced in #2229, where the installation is parallelized. The installation state was saved [in the `WorkflowsDeployment`](https://github.com/databrickslabs/ucx/blob/58607092f49b470b7f34577afda9b641dddb97cc/src/databricks/labs/ucx/installer/workflows.py#L449), which happened after dashboard deployment before parralelization. ### Linked issues Resolves #2273 ### Functionality - [x] modified existing command: `databricks labs install ucx` ### Tests - [x] added integration tests
1 parent 5860709 commit 966fc75

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/databricks/labs/ucx/install.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ def run(self) -> bool:
508508
if self.config.trigger_job:
509509
logger.info("Triggering the assessment workflow")
510510
self._trigger_workflow("assessment")
511+
self._install_state.save()
511512
return True
512513

513514
def _create_database_and_dashboards(self) -> None:

tests/integration/install/test_installation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import databricks
1010
from databricks.labs.blueprint.installation import Installation
11+
from databricks.labs.blueprint.installer import InstallState
1112
from databricks.labs.blueprint.parallel import ManyError
1213
from databricks.labs.blueprint.tui import MockPrompts
1314
from databricks.labs.blueprint.wheels import ProductInfo
@@ -248,6 +249,17 @@ def test_installation_when_dashboard_id_is_invalid(ws, installation_ctx, dashboa
248249
assert dashboard_id != new_dashboard_id, "Dashboard id is not updated"
249250

250251

252+
def test_installation_stores_install_state_keys(ws, installation_ctx):
253+
"""The installation should store the keys in the installation state."""
254+
expected_keys = "jobs", "dashboards"
255+
installation_ctx.workspace_installation.run()
256+
# Refresh the installation state, the installation context uses `@cached_property`
257+
install_state = InstallState.from_installation(installation_ctx.installation)
258+
for key in expected_keys:
259+
assert hasattr(install_state, key), f"Missing key in install state: {key}"
260+
assert getattr(install_state, key), f"Installation state is empty: {key}"
261+
262+
251263
@retried(on=[NotFound], timeout=timedelta(minutes=2))
252264
def test_uninstallation(ws, sql_backend, installation_ctx):
253265
installation_ctx.workspace_installation.run()

0 commit comments

Comments
 (0)