awdavidson commented on code in PR #752:
URL: https://github.com/apache/iceberg-python/pull/752#discussion_r1712607393


##########
tests/catalog/test_hive.py:
##########
@@ -1195,3 +1195,40 @@ def test_hive_wait_for_lock() -> None:
     with pytest.raises(WaitingForLockException):
         catalog._wait_for_lock("db", "tbl", lockid, catalog._client)
     assert catalog._client.check_lock.call_count == 5
+
+def test_create_hive_client_success():
+    properties = {
+        "uri": "thrift://localhost:10000",
+        "ugi": "user"
+    }
+
+    with patch('pyiceberg.catalog.hive._HiveClient', return_value=MagicMock()) 
as mock_hive_client:
+        client = HiveCatalog._create_hive_client(properties)
+        mock_hive_client.assert_called_once_with("thrift://localhost:10000", 
"user")
+        assert client is not None
+
+def test_create_hive_client_multiple_uris():
+    properties = {
+        "uri": "thrift://localhost:10000,thrift://localhost:10001",
+        "ugi": "user"
+    }
+
+    with patch('pyiceberg.catalog.hive._HiveClient') as mock_hive_client:
+        mock_hive_client.side_effect = [Exception("Connection failed"), 
MagicMock()]

Review Comment:
   Thank you for your comments. Yes this means the first connections will fail.
   
   Scenario `2 uris; both passes` will never be a valid case, if the first uri 
passes the second is never tried. So the only additional test would be to add 
one covering `(optional) 2 uris; 1 pass, second one not tried`
   



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to