Skip to content

Commit 8aee895

Browse files
ai: apply changes for #919 (2 review threads)
Addresses: - #3811121476 at src/databricks/sql/backend/kernel/auth_bridge.py:158 - #3824120741 at tests/unit/test_kernel_auth_bridge.py:36 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
1 parent 463794c commit 8aee895

3 files changed

Lines changed: 3 additions & 15 deletions

File tree

src/databricks/sql/backend/kernel/auth_bridge.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def _extract_bearer_token(auth_provider: Optional[AuthProvider]) -> Optional[str
155155
def kernel_auth_kwargs(
156156
auth_provider: Optional[AuthProvider],
157157
auth_options: Optional[Dict[str, Any]] = None,
158-
hostname: Optional[str] = None,
159158
) -> Dict[str, Any]:
160159
"""Build the kwargs passed to ``databricks_sql_kernel.Session(...)``.
161160

src/databricks/sql/backend/kernel/client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ def open_session(
312312
auth_kwargs = kernel_auth_kwargs(
313313
self._auth_provider,
314314
self._auth_options,
315-
hostname=self._server_hostname,
316315
)
317316
# Translate the connector's SSLOptions into the kernel's
318317
# ``tls_*`` Session kwargs. Empty when TLS is at defaults.

tests/unit/test_kernel_auth_bridge.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
PYSQL_OAUTH_SCOPES,
3434
PYSQL_OAUTH_REDIRECT_PORT_RANGE,
3535
)
36-
from databricks.sql.auth.common import get_effective_azure_login_app_id
3736
from databricks.sql.auth.authenticators import (
3837
AccessTokenAuthProvider,
3938
AuthProvider,
@@ -676,7 +675,6 @@ def test_azure_sp_m2m_forwards_creds_to_kernel(self):
676675
kwargs = kernel_auth_kwargs(
677676
_FakeOAuthProvider(),
678677
dict(self._CREDS),
679-
hostname="adb-1.azuredatabricks.net",
680678
)
681679
# Thin forwarding: the kernel owns endpoint/scope resolution, so no
682680
# token_url / oauth_scopes are constructed here.
@@ -696,9 +694,7 @@ def test_azure_sp_m2m_tenant_optional_kernel_autodiscovers(self):
696694
"azure_client_id": "azure-sp",
697695
"azure_client_secret": "azure-secret",
698696
}
699-
kwargs = kernel_auth_kwargs(
700-
_FakeOAuthProvider(), opts, hostname="adb-1.azuredatabricks.net"
701-
)
697+
kwargs = kernel_auth_kwargs(_FakeOAuthProvider(), opts)
702698
assert kwargs == {
703699
"auth_type": "azure-sp-m2m",
704700
"azure_client_id": "azure-sp",
@@ -714,9 +710,7 @@ def test_azure_sp_m2m_forwards_workspace_resource_id(self):
714710
self._CREDS,
715711
azure_workspace_resource_id="/subscriptions/s/resourceGroups/rg/workspace/w",
716712
)
717-
kwargs = kernel_auth_kwargs(
718-
_FakeOAuthProvider(), opts, hostname="adb-1.azuredatabricks.net"
719-
)
713+
kwargs = kernel_auth_kwargs(_FakeOAuthProvider(), opts)
720714
assert (
721715
kwargs["azure_workspace_resource_id"]
722716
== "/subscriptions/s/resourceGroups/rg/workspace/w"
@@ -726,7 +720,6 @@ def test_azure_sp_m2m_omits_workspace_resource_id_when_absent(self):
726720
kwargs = kernel_auth_kwargs(
727721
_FakeOAuthProvider(),
728722
dict(self._CREDS),
729-
hostname="adb-1.azuredatabricks.net",
730723
)
731724
assert "azure_workspace_resource_id" not in kwargs
732725

@@ -735,14 +728,11 @@ def test_azure_sp_m2m_requires_client_id_and_secret(self):
735728
kernel_auth_kwargs(
736729
_FakeOAuthProvider(),
737730
{"auth_type": "azure-sp-m2m", "azure_tenant_id": "t"},
738-
hostname="adb-1.azuredatabricks.net",
739731
)
740732

741733
def test_azure_sp_m2m_forwards_federation_client_id(self):
742734
opts = dict(self._CREDS, identity_federation_client_id="fed-client")
743-
kwargs = kernel_auth_kwargs(
744-
_FakeOAuthProvider(), opts, hostname="adb-1.azuredatabricks.net"
745-
)
735+
kwargs = kernel_auth_kwargs(_FakeOAuthProvider(), opts)
746736
assert kwargs["identity_federation_client_id"] == "fed-client"
747737

748738

0 commit comments

Comments
 (0)