Skip to content

Commit 9ac6490

Browse files
authored
Added failure injection for job failure message propagation (#591)
Closes #554 Closes #564
1 parent db89a2e commit 9ac6490

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

src/databricks/labs/ucx/install.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ def run_for_config(
212212
override_clusters: dict[str, str] | None = None,
213213
sql_backend: SqlBackend = None,
214214
) -> "WorkspaceInstaller":
215-
logger.info(f"Installing UCX v{__version__} on {ws.config.host}")
216215
workspace_installer = WorkspaceInstaller(ws, prefix=prefix, promtps=False, sql_backend=sql_backend)
217216
logger.info(f"Installing UCX v{workspace_installer._version} on {ws.config.host}")
218217
workspace_installer._config = config

tests/integration/test_installation.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
logger = logging.getLogger(__name__)
1919

2020

21-
def test_destroying_non_existing_schema_fails_with_correct_message(ws, sql_backend, env_or_skip, make_random):
21+
def test_job_failure_propagates_correct_error_message_and_logs(ws, sql_backend, env_or_skip, make_random):
2222
default_cluster_id = env_or_skip("TEST_DEFAULT_CLUSTER_ID")
2323
tacl_cluster_id = env_or_skip("TEST_LEGACY_TABLE_ACL_CLUSTER_ID")
2424
ws.clusters.ensure_cluster_is_running(default_cluster_id)
@@ -44,35 +44,13 @@ def test_destroying_non_existing_schema_fails_with_correct_message(ws, sql_backe
4444
},
4545
)
4646

47+
sql_backend.execute(f"DROP SCHEMA {inventory_database} CASCADE")
48+
4749
with pytest.raises(OperationFailed) as failure:
4850
install.run_workflow("099-destroy-schema")
4951

5052
assert "cannot be found" in str(failure.value)
5153

52-
53-
def test_logs_are_available(ws, sql_backend, env_or_skip, make_random):
54-
default_cluster_id = env_or_skip("TEST_DEFAULT_CLUSTER_ID")
55-
ws.clusters.ensure_cluster_is_running(default_cluster_id)
56-
57-
install = WorkspaceInstaller.run_for_config(
58-
ws,
59-
WorkspaceConfig(
60-
inventory_database=f"ucx_{make_random(4)}",
61-
instance_pool_id=env_or_skip("TEST_INSTANCE_POOL_ID"),
62-
groups=GroupsConfig(auto=True),
63-
log_level="INFO",
64-
),
65-
sql_backend=sql_backend,
66-
prefix=make_random(4),
67-
override_clusters={
68-
"main": default_cluster_id,
69-
},
70-
)
71-
72-
with pytest.raises(OperationFailed):
73-
install.run_workflow("099-destroy-schema")
74-
assert True
75-
7654
workflow_run_logs = list(ws.workspace.list(f"{install._install_folder}/logs"))
7755
assert len(workflow_run_logs) == 1
7856

0 commit comments

Comments
 (0)