Skip to content

Commit 194c966

Browse files
authored
test: stabilize UC-cluster flake retry and ACL skip ordering (#1473)
## Summary Two test-only fixes triggered by nightly run [26192790727](https://github.com/databricks/dbt-databricks/actions/runs/26192790727). Both observed failures were environmental — no dbt-databricks regression. - **`TestSpecifyingHttpPath`** — add `@pytest.mark.flaky(reruns=2, reruns_delay=120)`. The test drives a python model on the shared UC all-purpose cluster, which intermittently fails with *"Could not reach driver of cluster"*. Same failure observed on at least 4 nightly/dispatch runs spanning 3 unrelated SHAs (2026-05-08, 2026-05-14, 2026-05-20 ×2). Real assertion failures still surface; only transient cluster-warm issues retry. - **`TestPythonModelNotebookACL` + `TestPythonModelAccessControlList`** — move `ACL_TESTS_ENABLED` skip from test body to class-level `@pytest.mark.skipif`. The `project` fixture is class-scope and ran before the in-body skip, so a transient SQL-warehouse AADSTS blip in the failing nightly turned a clean SKIP into ERROR at setup. `skipif` fires before any fixture runs. ## Test plan - [x] `hatch run pre-commit run --all-files` clean. - [x] Skip path (ACL disabled): `1 skipped in 0.68s`, no DB hit. - [x] Run path (`DBT_ENABLE_ACL_TESTS=1 --profile databricks_uc_cluster`): body executes end-to-end through the ACL API call; fails only because `DBT_TEST_USER_*` is unset (workspace user does not exist) — equivalent to today's CI state where ACL tests are off. - [ ] Run integration tests to verify
1 parent 312563e commit 194c966

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

tests/functional/adapter/python_model/test_python_model.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def test_changing_schema_via_incremental(self, project):
138138

139139
@pytest.mark.python
140140
@pytest.mark.skip_profile("databricks_cluster", "databricks_uc_cluster")
141+
@pytest.mark.flaky(reruns=2, reruns_delay=120)
141142
class TestSpecifyingHttpPath(BasePythonModelTests):
142143
@pytest.fixture(scope="class")
143144
def models(self):
@@ -280,6 +281,9 @@ def test_workflow_run(self, project):
280281
@pytest.mark.python
281282
@pytest.mark.acl
282283
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
284+
@pytest.mark.skipif(
285+
not ACL_TESTS_ENABLED, reason="ACL tests disabled (set DBT_ENABLE_ACL_TESTS=1 to enable)"
286+
)
283287
class TestPythonModelNotebookACL:
284288
@pytest.fixture(scope="class")
285289
def models(self):
@@ -293,9 +297,6 @@ def project_config_update(self):
293297
return {"models": {"+create_notebook": "true"}}
294298

295299
def test_python_model_with_notebook_acl(self, project):
296-
if not ACL_TESTS_ENABLED:
297-
pytest.skip("ACL tests are not enabled")
298-
299300
result = util.run_dbt(["run"])
300301
assert len(result) == 1
301302

@@ -346,6 +347,9 @@ def test_python_model_with_notebook_acl(self, project):
346347
@pytest.mark.python
347348
@pytest.mark.acl
348349
@pytest.mark.skip_profile("databricks_uc_sql_endpoint")
350+
@pytest.mark.skipif(
351+
not ACL_TESTS_ENABLED, reason="ACL tests disabled (set DBT_ENABLE_ACL_TESTS=1 to enable)"
352+
)
349353
class TestPythonModelAccessControlList:
350354
@pytest.fixture(scope="class")
351355
def models(self):
@@ -359,9 +363,6 @@ def project_config_update(self):
359363
return {"models": {"+create_notebook": "true"}}
360364

361365
def test_python_model_with_access_control_list(self, project):
362-
if not ACL_TESTS_ENABLED:
363-
pytest.skip("ACL tests are not enabled")
364-
365366
adapter = project.adapter
366367
conn_mgr = adapter.connections
367368
api_client = conn_mgr.api_client

0 commit comments

Comments
 (0)