kaxil commented on code in PR #57334:
URL: https://github.com/apache/airflow/pull/57334#discussion_r2465168263


##########
task-sdk/tests/task_sdk/api/test_client.py:
##########
@@ -1366,3 +1366,33 @@ def handle_request(request: httpx.Request) -> 
httpx.Response:
         assert result.params_input == {}
         assert result.responded_by_user == HITLUser(id="admin", name="admin")
         assert result.responded_at == timezone.datetime(2025, 7, 3, 0, 0, 0)
+
+
+class TestSSLContextCaching:
+    def setup_method(self):
+        Client._get_ssl_context_cached.cache_clear()
+
+    def teardown_method(self):
+        Client._get_ssl_context_cached.cache_clear()
+
+    def test_cache_hit_on_same_parameters(self):
+        import certifi
+
+        ca_file = certifi.where()
+        ctx1 = Client._get_ssl_context_cached(ca_file, "")
+        ctx2 = Client._get_ssl_context_cached(ca_file, "")

Review Comment:
   If we make the default `None`, we don't need to pass empty string `""`



##########
task-sdk/tests/task_sdk/api/test_client.py:
##########
@@ -1366,3 +1366,33 @@ def handle_request(request: httpx.Request) -> 
httpx.Response:
         assert result.params_input == {}
         assert result.responded_by_user == HITLUser(id="admin", name="admin")
         assert result.responded_at == timezone.datetime(2025, 7, 3, 0, 0, 0)
+
+
+class TestSSLContextCaching:
+    def setup_method(self):
+        Client._get_ssl_context_cached.cache_clear()
+
+    def teardown_method(self):
+        Client._get_ssl_context_cached.cache_clear()
+
+    def test_cache_hit_on_same_parameters(self):
+        import certifi
+
+        ca_file = certifi.where()
+        ctx1 = Client._get_ssl_context_cached(ca_file, "")
+        ctx2 = Client._get_ssl_context_cached(ca_file, "")
+        assert ctx1 is ctx2
+
+    def test_cache_miss_on_different_parameters(self):
+        import certifi
+
+        ca_file = certifi.where()
+
+        ctx1 = Client._get_ssl_context_cached(ca_file, "")

Review Comment:
   If we make the default `None`, we don't need to pass empty string ""
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to