angelo-DNAStack commented on code in PR #12743:
URL: https://github.com/apache/iceberg/pull/12743#discussion_r2195741397
##########
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:
Done, also updated the same code in one of the existing tests for
consistency's sake
--
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]