pan3793 commented on code in PR #6935:
URL: https://github.com/apache/kyuubi/pull/6935#discussion_r1969882005


##########
python/pyhive/tests/test_hive.py:
##########
@@ -238,9 +239,29 @@ def test_custom_connection(self):
             subprocess.check_call(['sudo', 'cp', orig_none, des])
             _restart_hs2()
 
+    @pytest.mark.skip(reason="Need a proper setup for SSL context testing")
+    def test_basic_ssl_context(self):
+        """Test that connection works with a custom SSL context that mimics 
the default behavior."""
+        # Create an SSL context similar to what Connection creates by default
+        ssl_context = ssl.create_default_context()
+        ssl_context.check_hostname = False
+        ssl_context.verify_mode = ssl.CERT_NONE
+        
+        # Connect using the same parameters as self.connect() but with our 
custom context
+        with contextlib.closing(hive.connect(
+            host=_HOST,
+            port=10000,
+            configuration={'mapred.job.tracker': 'local'},
+            ssl_context=ssl_context
+        )) as connection:
+            with contextlib.closing(connection.cursor()) as cursor:
+                # Use the same query pattern as other tests
+                cursor.execute('SELECT 1 FROM one_row')
+                self.assertEqual(cursor.fetchall(), [(1,)])
+
 
 def _restart_hs2():
     subprocess.check_call(['sudo', 'service', 'hive-server2', 'restart'])
     with contextlib.closing(socket.socket()) as s:
         while s.connect_ex(('localhost', 10000)) != 0:
-            time.sleep(1)
+            time.sleep(1)

Review Comment:
   ```suggestion
               time.sleep(1)
   ```



##########
python/pyhive/tests/test_hive.py:
##########
@@ -238,9 +239,29 @@ def test_custom_connection(self):
             subprocess.check_call(['sudo', 'cp', orig_none, des])
             _restart_hs2()
 
+    @pytest.mark.skip(reason="Need a proper setup for SSL context testing")
+    def test_basic_ssl_context(self):
+        """Test that connection works with a custom SSL context that mimics 
the default behavior."""
+        # Create an SSL context similar to what Connection creates by default
+        ssl_context = ssl.create_default_context()
+        ssl_context.check_hostname = False
+        ssl_context.verify_mode = ssl.CERT_NONE
+        
+        # Connect using the same parameters as self.connect() but with our 
custom context
+        with contextlib.closing(hive.connect(
+            host=_HOST,
+            port=10000,
+            configuration={'mapred.job.tracker': 'local'},
+            ssl_context=ssl_context
+        )) as connection:
+            with contextlib.closing(connection.cursor()) as cursor:
+                # Use the same query pattern as other tests
+                cursor.execute('SELECT 1 FROM one_row')
+                self.assertEqual(cursor.fetchall(), [(1,)])
+
 
 def _restart_hs2():
     subprocess.check_call(['sudo', 'service', 'hive-server2', 'restart'])
     with contextlib.closing(socket.socket()) as s:
         while s.connect_ex(('localhost', 10000)) != 0:
-            time.sleep(1)
+            time.sleep(1)

Review Comment:
   ```suggestion
               time.sleep(1)
   
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to