This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new a9036487c RATIS-1830. Intermittent failure in TestRetryPolicy (#871)
a9036487c is described below

commit a9036487c5f09e8f1132be9655eb54a177573e7c
Author: Kaijie Chen <[email protected]>
AuthorDate: Tue Apr 11 22:07:11 2023 +0800

    RATIS-1830. Intermittent failure in TestRetryPolicy (#871)
---
 .../src/test/java/org/apache/ratis/retry/TestRetryPolicy.java       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/ratis-test/src/test/java/org/apache/ratis/retry/TestRetryPolicy.java 
b/ratis-test/src/test/java/org/apache/ratis/retry/TestRetryPolicy.java
index 3bd4b6b66..d69cd1a2e 100644
--- a/ratis-test/src/test/java/org/apache/ratis/retry/TestRetryPolicy.java
+++ b/ratis-test/src/test/java/org/apache/ratis/retry/TestRetryPolicy.java
@@ -130,7 +130,7 @@ public class TestRetryPolicy extends BaseTest {
     final RequestTypeDependentRetryPolicy.Builder b = 
RequestTypeDependentRetryPolicy.newBuilder();
     b.setRetryPolicy(RaftClientRequestProto.TypeCase.WRITE, 
RetryPolicies.retryForeverNoSleep());
     b.setRetryPolicy(RaftClientRequestProto.TypeCase.WATCH, 
RetryPolicies.retryForeverNoSleep());
-    TimeDuration timeout = TimeDuration.valueOf(10, TimeUnit.MILLISECONDS);
+    TimeDuration timeout = TimeDuration.valueOf(100, TimeUnit.MILLISECONDS);
     final RetryPolicy policy = 
b.setTimeout(RaftClientRequestProto.TypeCase.WRITE, timeout)
             .setTimeout(RaftClientRequestProto.TypeCase.WATCH, 
timeout).build();
     LOG.info("policy = {}", policy);
@@ -154,7 +154,7 @@ public class TestRetryPolicy extends BaseTest {
       Assert.assertEquals(0L, action.getSleepTime().getDuration());
     }
 
-    Thread.sleep(timeout.toLong(TimeUnit.MILLISECONDS) * 10);
+    timeout.sleep();
     for (RaftClientRequest request : requests) {
       final ClientRetryEvent event = new ClientRetryEvent(request, new 
Exception(), pending);
       final RetryPolicy.Action action = policy.handleAttemptFailure(event);
@@ -298,4 +298,4 @@ public class TestRetryPolicy extends BaseTest {
       this.sleepTime = sleepTime;
     }
   }
-}
\ No newline at end of file
+}

Reply via email to