mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Make @Retryable timeout tests more robust
See gh-35963
This commit is contained in:
+4
-4
@@ -481,23 +481,23 @@ class ReactiveRetryInterceptorTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Retryable(timeout = 5, delay = 0)
|
||||
@Retryable(timeout = 20, delay = 0)
|
||||
public Mono<Object> retryOperationWithTimeoutExceededAfterFirstRetry() {
|
||||
return Mono.fromCallable(() -> {
|
||||
counter.incrementAndGet();
|
||||
if (counter.get() == 2) {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(50);
|
||||
}
|
||||
throw new IOException(counter.toString());
|
||||
});
|
||||
}
|
||||
|
||||
@Retryable(timeout = 5, delay = 0)
|
||||
@Retryable(timeout = 20, delay = 0)
|
||||
public Mono<Object> retryOperationWithTimeoutExceededAfterSecondRetry() {
|
||||
return Mono.fromCallable(() -> {
|
||||
counter.incrementAndGet();
|
||||
if (counter.get() == 3) {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(50);
|
||||
}
|
||||
throw new IOException(counter.toString());
|
||||
});
|
||||
|
||||
+4
-4
@@ -439,20 +439,20 @@ class RetryInterceptorTests {
|
||||
throw new IOException(Integer.toString(counter));
|
||||
}
|
||||
|
||||
@Retryable(timeout = 5, delay = 0)
|
||||
@Retryable(timeout = 20, delay = 0)
|
||||
public void retryOperationWithTimeoutExceededAfterFirstRetry() throws Exception {
|
||||
counter++;
|
||||
if (counter == 2) {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(50);
|
||||
}
|
||||
throw new IOException(Integer.toString(counter));
|
||||
}
|
||||
|
||||
@Retryable(timeout = 5, delay = 0)
|
||||
@Retryable(timeout = 20, delay = 0)
|
||||
public void retryOperationWithTimeoutExceededAfterSecondRetry() throws Exception {
|
||||
counter++;
|
||||
if (counter == 3) {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(50);
|
||||
}
|
||||
throw new IOException(Integer.toString(counter));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user