Skip to content

Commit ab4de62

Browse files
Apply #2169 changes to async code
1 parent a27b3d6 commit ab4de62

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/snowflake/connector/aio/_connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async def __open_connection(self):
170170
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_URL"],
171171
)
172172

173-
if ".privatelink.snowflakecomputing." in self.host:
173+
if ".privatelink.snowflakecomputing." in self.host.lower():
174174
await SnowflakeConnection.setup_ocsp_privatelink(
175175
self.application, self.host
176176
)
@@ -969,6 +969,7 @@ async def get_query_status_throw_if_error(self, sf_qid: str) -> QueryStatus:
969969

970970
@staticmethod
971971
async def setup_ocsp_privatelink(app, hostname) -> None:
972+
hostname = hostname.lower()
972973
async with SnowflakeConnection.OCSP_ENV_LOCK:
973974
ocsp_cache_server = f"http://ocsp.{hostname}/ocsp_response_cache.json"
974975
os.environ["SF_OCSP_RESPONSE_CACHE_SERVER_URL"] = ocsp_cache_server

test/integ/aio/test_connection_async.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,19 @@ async def test_privatelink_ocsp_url_concurrent_snowsql():
783783
raise AssertionError()
784784

785785

786+
@pytest.mark.skipolddriver
787+
async def test_uppercase_privatelink_ocsp_url_creation():
788+
account = "TESTACCOUNT.US-EAST-1.PRIVATELINK"
789+
hostname = account + ".snowflakecomputing.com"
790+
791+
await SnowflakeConnection.setup_ocsp_privatelink(CLIENT_NAME, hostname)
792+
ocsp_cache_server = os.getenv("SF_OCSP_RESPONSE_CACHE_SERVER_URL", None)
793+
assert (
794+
ocsp_cache_server
795+
== "http://ocsp.testaccount.us-east-1.privatelink.snowflakecomputing.com/ocsp_response_cache.json"
796+
)
797+
798+
786799
class ExecPrivatelinkAsyncTask:
787800
def __init__(self, bucket, hostname, expectation, client_name):
788801
self.bucket = bucket

0 commit comments

Comments
 (0)