Skip to content

Commit 3a71dad

Browse files
[async] disable endpoint-based platform autodetection + add fixture
1 parent 949aa9a commit 3a71dad

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/snowflake/connector/aio/_connection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ def __init__(
113113
# note we don't call super here because asyncio can not/is not recommended
114114
# to perform async operation in the __init__ while in the sync connection we
115115
# perform connect
116+
117+
# SNOW-2352456: disable endpoint-based platform detection queries for async connection
118+
kwargs["platform_detection_timeout_seconds"] = 0.0
119+
116120
self._conn_parameters = self._init_connection_parameters(
117121
kwargs, connection_name, connections_file_path
118122
)

src/snowflake/connector/aio/auth/_auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async def authenticate(
102102
self._rest._connection._login_timeout,
103103
self._rest._connection._network_timeout,
104104
self._rest._connection._socket_timeout,
105+
self._rest._connection._platform_detection_timeout_seconds,
105106
)
106107

107108
body = copy.deepcopy(body_template)

test/unit/aio/test_connection_async_unit.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@
5151
from snowflake.connector.wif_util import AttestationProvider
5252

5353

54+
@pytest.fixture(autouse=True)
55+
def mock_detect_platforms():
56+
with patch(
57+
"snowflake.connector.auth._auth.detect_platforms", return_value=[]
58+
) as mock_detect:
59+
yield mock_detect
60+
61+
5462
def fake_connector(**kwargs) -> snowflake.connector.aio.SnowflakeConnection:
5563
return snowflake.connector.aio.SnowflakeConnection(
5664
user="user",

0 commit comments

Comments
 (0)