@@ -413,14 +413,14 @@ class TimeoutTests {
413413
414414 @ Test
415415 void retryWithImmediateSuccessAndTimeoutExceeded () throws Exception {
416- RetryPolicy retryPolicy = RetryPolicy .builder ().timeout (Duration .ofMillis (5 )).build ();
416+ RetryPolicy retryPolicy = RetryPolicy .builder ().timeout (Duration .ofMillis (10 )).build ();
417417 RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
418418 retryTemplate .setRetryListener (retryListener );
419419
420420 AtomicInteger invocationCount = new AtomicInteger ();
421421 Retryable <String > retryable = () -> {
422422 invocationCount .incrementAndGet ();
423- Thread .sleep (10 );
423+ Thread .sleep (100 );
424424 return "always succeeds" ;
425425 };
426426
@@ -435,15 +435,15 @@ void retryWithImmediateSuccessAndTimeoutExceeded() throws Exception {
435435 @ Test
436436 void retryWithInitialFailureAndZeroRetriesRetryPolicyAndTimeoutExceeded () {
437437 RetryPolicy retryPolicy = RetryPolicy .builder ()
438- .timeout (Duration .ofMillis (5 ))
438+ .timeout (Duration .ofMillis (10 ))
439439 .predicate (throwable -> false ) // Zero retries
440440 .build ();
441441 RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
442442 retryTemplate .setRetryListener (retryListener );
443443
444444 Exception exception = new RuntimeException ("Boom!" );
445445 Retryable <String > retryable = () -> {
446- Thread .sleep (10 );
446+ Thread .sleep (100 );
447447 throw exception ;
448448 };
449449
@@ -461,22 +461,22 @@ void retryWithInitialFailureAndZeroRetriesRetryPolicyAndTimeoutExceeded() {
461461 @ Test
462462 void retryWithTimeoutExceededAfterInitialFailure () throws Exception {
463463 RetryPolicy retryPolicy = RetryPolicy .builder ()
464- .timeout (Duration .ofMillis (5 ))
464+ .timeout (Duration .ofMillis (10 ))
465465 .delay (Duration .ZERO )
466466 .build ();
467467 RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
468468 retryTemplate .setRetryListener (retryListener );
469469
470470 AtomicInteger invocationCount = new AtomicInteger ();
471471 Retryable <String > retryable = () -> {
472- Thread .sleep (10 );
472+ Thread .sleep (100 );
473473 throw new CustomException ("Boom " + invocationCount .incrementAndGet ());
474474 };
475475
476476 assertThat (invocationCount ).hasValue (0 );
477477 assertThatExceptionOfType (RetryException .class )
478478 .isThrownBy (() -> retryTemplate .execute (retryable ))
479- .withMessageMatching ("Retry policy for operation '.+?' exceeded timeout \\ (5ms \\ ); aborting execution" )
479+ .withMessageMatching ("Retry policy for operation '.+?' exceeded timeout \\ (10ms \\ ); aborting execution" )
480480 .withCause (new CustomException ("Boom 1" ))
481481 .satisfies (throwable -> inOrder .verify (retryListener ).onRetryPolicyTimeout (
482482 eq (retryPolicy ), eq (retryable ), eq (throwable )));
@@ -488,8 +488,8 @@ void retryWithTimeoutExceededAfterInitialFailure() throws Exception {
488488 @ Test
489489 void retryWithTimeoutExceededAfterFirstDelayButBeforeFirstRetry () throws Exception {
490490 RetryPolicy retryPolicy = RetryPolicy .builder ()
491- .timeout (Duration .ofMillis (5 ))
492- .delay (Duration .ofMillis (10 )) // Delay > Timeout
491+ .timeout (Duration .ofMillis (20 ))
492+ .delay (Duration .ofMillis (100 )) // Delay > Timeout
493493 .build ();
494494 RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
495495 retryTemplate .setRetryListener (retryListener );
@@ -503,8 +503,8 @@ void retryWithTimeoutExceededAfterFirstDelayButBeforeFirstRetry() throws Excepti
503503 assertThatExceptionOfType (RetryException .class )
504504 .isThrownBy (() -> retryTemplate .execute (retryable ))
505505 .withMessageMatching ("""
506- Retry policy for operation '.+?' would exceed timeout \\ (5ms \\ ) \
507- due to pending sleep time \\ (10ms \\ ); preemptively aborting execution\
506+ Retry policy for operation '.+?' would exceed timeout \\ (20ms \\ ) \
507+ due to pending sleep time \\ (100ms \\ ); preemptively aborting execution\
508508 """ )
509509 .withCause (new CustomException ("Boom 1" ))
510510 .satisfies (throwable -> inOrder .verify (retryListener ).onRetryPolicyTimeout (
@@ -527,7 +527,7 @@ void retryWithTimeoutExceededAfterFirstRetry() throws Exception {
527527 Retryable <String > retryable = () -> {
528528 int currentInvocation = invocationCount .incrementAndGet ();
529529 if (currentInvocation == 2 ) {
530- Thread .sleep (50 );
530+ Thread .sleep (100 );
531531 }
532532 throw new CustomException ("Boom " + currentInvocation );
533533 };
@@ -562,7 +562,7 @@ void retryWithTimeoutExceededAfterSecondRetry() throws Exception {
562562 Retryable <String > retryable = () -> {
563563 int currentInvocation = invocationCount .incrementAndGet ();
564564 if (currentInvocation == 3 ) {
565- Thread .sleep (50 );
565+ Thread .sleep (100 );
566566 }
567567 throw new CustomException ("Boom " + currentInvocation );
568568 };
0 commit comments