diff --git a/src/ucode/databricks.py b/src/ucode/databricks.py index 90c1808..08733ba 100644 --- a/src/ucode/databricks.py +++ b/src/ucode/databricks.py @@ -483,7 +483,7 @@ def _run_databricks_cli_installer(brew_subcommand: str = "install") -> None: timeout=240, ) elif system == "Darwin" and shutil.which("brew"): - run(["brew", brew_subcommand, "databricks"], timeout=240) + run(["brew", brew_subcommand, "databricks/tap/databricks"], timeout=240) elif shutil.which("curl"): run(["sh", "-c", f"curl -fsSL {UNIX_DATABRICKS_INSTALL_URL} | sudo sh"], timeout=240) elif shutil.which("wget"): diff --git a/tests/test_databricks.py b/tests/test_databricks.py index fffdba5..45c4350 100644 --- a/tests/test_databricks.py +++ b/tests/test_databricks.py @@ -13,6 +13,7 @@ AI_GATEWAY_V2_DOCS_URL, _format_subprocess_result, _parse_databricks_cli_version, + _run_databricks_cli_installer, _scrub_databrickscfg, _scrub_json, build_auth_shell_command, @@ -804,6 +805,22 @@ def test_raises_when_version_unparseable(self, tmp_path, monkeypatch): ensure_databricks_cli_version() +class TestRunDatabricksCliInstaller: + @pytest.mark.parametrize("brew_subcommand", ["install", "upgrade"]) + def test_macos_uses_fully_qualified_tap_formula(self, monkeypatch, brew_subcommand): + calls = [] + monkeypatch.setattr(db_mod.platform, "system", lambda: "Darwin") + monkeypatch.setattr(db_mod.shutil, "which", lambda cmd: "/opt/homebrew/bin/brew") + monkeypatch.setattr(db_mod, "run", lambda cmd, **kw: calls.append(cmd)) + + _run_databricks_cli_installer(brew_subcommand=brew_subcommand) + + # The fully-qualified formula forces Homebrew to the Databricks CLI in + # databricks/tap and fails if absent, rather than falling back to the + # unrelated `databricks` cask. + assert calls == [["brew", brew_subcommand, "databricks/tap/databricks"]] + + class TestIsUsageTableAccessError: """Pin which `ServerOperationError` strings trigger the friendly `system.ai_gateway.usage` permissions hint vs. fall through to the