curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [2/3] git commit: Add timing for better test reliability
Date Fri, 08 Nov 2013 16:40:49 GMT
Add timing for better test reliability


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c5a7ee40
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c5a7ee40
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c5a7ee40

Branch: refs/heads/master
Commit: c5a7ee402fb57a2994501599b14e8d7b4bd94210
Parents: 139ec3b
Author: randgalt <randgalt@apache.org>
Authored: Fri Nov 8 08:32:19 2013 -0800
Committer: randgalt <randgalt@apache.org>
Committed: Fri Nov 8 08:32:19 2013 -0800

----------------------------------------------------------------------
 .../curator/framework/imps/TestFrameworkBackground.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c5a7ee40/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
index 8527a14..5aa1353 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
@@ -34,7 +34,6 @@ import org.testng.annotations.Test;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
 public class TestFrameworkBackground extends BaseClassForTests
@@ -127,11 +126,12 @@ public class TestFrameworkBackground extends BaseClassForTests
     @Test
     public void testCuratorCallbackOnError() throws Exception
     {
-
+        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.builder()
             .connectString(server.getConnectString())
-            .sessionTimeoutMs(60000)
-            .retryPolicy(new RetryNTimes(1, 1000)).build();
+            .sessionTimeoutMs(timing.session())
+            .connectionTimeoutMs(timing.connection())
+            .retryPolicy(new RetryOneTime(1000)).build();
         final CountDownLatch latch = new CountDownLatch(1);
         try
         {
@@ -154,7 +154,7 @@ public class TestFrameworkBackground extends BaseClassForTests
             // Attempt to retrieve children list
             client.getChildren().inBackground(curatorCallback).forPath("/");
             // Check if the callback has been called with a correct return code
-            Assert.assertTrue(latch.await(10, TimeUnit.SECONDS), "Callback has not been called
by curator !");
+            Assert.assertTrue(timing.awaitLatch(latch), "Callback has not been called by
curator !");
         }
         finally
         {


Mime
View raw message