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


##########
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()]
+
+        client = HiveCatalog._create_hive_client(properties)
+        assert mock_hive_client.call_count == 2
+        mock_hive_client.assert_any_call("thrift://localhost:10000", "user")
+        mock_hive_client.assert_any_call("thrift://localhost:10001", "user")

Review Comment:
   nit: assert that both 10000 and 10001 are called once



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