gharris1727 commented on code in PR #12791:
URL: https://github.com/apache/kafka/pull/12791#discussion_r1008325977
##########
connect/runtime/src/test/java/org/apache/kafka/connect/util/RetryUtilTest.java:
##########
@@ -116,16 +117,20 @@ public void testNoBackoffTimeAndSucceed() throws
Exception {
.thenThrow(new TimeoutException())
.thenReturn("success");
- assertEquals("success", RetryUtil.retryUntilTimeout(mockCallable,
testMsg, TIMEOUT, 0));
+ assertEquals("success", RetryUtil.retryUntilTimeout(mockCallable,
testMsg, Duration.ofMillis(100), 0, mockTime));
Mockito.verify(mockCallable, Mockito.times(4)).call();
}
@Test
public void testNoBackoffTimeAndFail() throws Exception {
- Mockito.when(mockCallable.call()).thenThrow(new
TimeoutException("timeout exception"));
+ Mockito.when(mockCallable.call()).thenAnswer(invocation -> {
+ // Without any backoff time, the speed of the operation itself
limits the number of retries and retry rate.
+ mockTime.sleep(30);
+ throw new TimeoutException("timeout exception");
+ });
Review Comment:
oh cool I didn't understand the intent of that feature, it's perfect for
this situation!
--
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]