nastra commented on code in PR #12743:
URL: https://github.com/apache/iceberg/pull/12743#discussion_r2182446858


##########
core/src/test/java/org/apache/iceberg/TestClientPoolImpl.java:
##########
@@ -44,6 +46,29 @@ public void testRetrySucceedsWithinMaxAttempts() throws 
Exception {
     }
   }
 
+  @Test
+  public void testRetryWithImplementationSpecificException() throws Exception {
+    int maxRetries = 5;
+    int succeedAfterAttempts = 3;
+    try (MockClientPoolImpl mockClientPool =
+        new MockClientPoolImpl(2, RetryableException.class, true, maxRetries)) 
{
+      // initial the client pool with a client, so that we can verify the 
client is replaced
+      MockClient firstClient = mockClientPool.newClient();
+      mockClientPool.clients().add(firstClient);
+
+      int actions =
+          mockClientPool.run(
+              client ->
+                  client.succeedAfter(
+                      succeedAfterAttempts, () -> new 
ImplementationSpecificException(true)));
+      assertThat(actions)
+          .as("There should be exactly one successful action invocation")
+          .isEqualTo(1);
+      
assertThat(mockClientPool.reconnectionAttempts()).isEqualTo(succeedAfterAttempts
 - 1);
+      
assertThat(mockClientPool.clients().peekFirst().equals(firstClient)).isFalse();

Review Comment:
   this should be 
`assertThat(mockClientPool.clients()).first().isNotEqualTo(firstClient);` as 
that is more fluent 



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