Jecarm commented on a change in pull request #2119:
URL: https://github.com/apache/iceberg/pull/2119#discussion_r567217920



##########
File path: 
hive-metastore/src/test/java/org/apache/iceberg/hive/TestClientPool.java
##########
@@ -51,4 +81,918 @@ protected void close(Object client) {
 
     }
   }
+
+  private static class MockHiveClientPool extends ClientPool<IMetaStoreClient, 
Exception> {
+
+    MockHiveClientPool(int poolSize, Class<? extends Exception> reconnectExc) {
+      super(poolSize, reconnectExc);
+    }
+
+    @Override
+    protected IMetaStoreClient newClient() {
+      return new MockMetaStoreFailureClient();

Review comment:
       I tried it with `Mockito`, like this:
   ```
   HiveClientPool clients = Mockito.mock(HiveClientPool.class);
   Mockito.doReturn(Lists.newArrayList("t1", "t2")).when(clients)
     .run(client -> client.getAllTables(Mockito.any(String.class)));
   
   hiveCatalog.listTables(Namespace.of("db1"))
   ```
   However,  the mock result is `null`  when call  `.run(client -> 
client.getAllTables(Mockito.any(String.class)))`.
   When  i use  `.run(Mockito.any(ClientPool.Action.class))` instead of 
`.run(client -> client.getAllTables(Mockito.any(String.class)))` , the reult is 
OK.
   
   So, How should i test the different client APIs @pvary ?
   
   




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

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