Repository: curator Updated Branches: refs/heads/CURATOR-490 [created] c8e041258
CURATOR-490 Using Timing object so that Jenkins runs to completion Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c8e04125 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c8e04125 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c8e04125 Branch: refs/heads/CURATOR-490 Commit: c8e0412588507d8e801477df686db66d44f2c6a2 Parents: d13a12f Author: randgalt <randg...@apache.org> Authored: Thu Dec 6 14:52:29 2018 -0500 Committer: randgalt <randg...@apache.org> Committed: Thu Dec 6 14:52:29 2018 -0500 ---------------------------------------------------------------------- .../apache/curator/framework/imps/TestFrameworkEdges.java | 4 ++-- .../curator/framework/recipes/cache/TestNodeCache.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/c8e04125/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java index f9b16af..0d832f1 100644 --- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java +++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java @@ -696,7 +696,7 @@ public class TestFrameworkEdges extends BaseClassForTests } }).start(); - Thread.sleep(20L); + timing.sleepABit(); try { client2.delete().forPath("/parent/child" + (childCount / 2)); @@ -713,7 +713,7 @@ public class TestFrameworkEdges extends BaseClassForTests } } - Assert.assertTrue(countDownLatch.await(10, TimeUnit.SECONDS)); + Assert.assertTrue(timing.awaitLatch(countDownLatch)); Assert.assertNull(client2.checkExists().forPath("/parent")); } http://git-wip-us.apache.org/repos/asf/curator/blob/c8e04125/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java index 2e81034..253c777 100644 --- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java +++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java @@ -21,6 +21,7 @@ package org.apache.curator.framework.recipes.cache; import org.apache.curator.framework.imps.TestCleanState; import org.apache.curator.test.BaseClassForTests; import org.apache.curator.test.compatibility.KillSession2; +import org.apache.curator.test.compatibility.Timing2; import org.apache.curator.utils.CloseableUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; @@ -106,6 +107,7 @@ public class TestNodeCache extends BaseClassForTests @Test public void testRebuildAgainstOtherProcesses() throws Exception { + Timing2 timing2 = new Timing2(); NodeCache cache = null; final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); client.start(); @@ -138,7 +140,7 @@ public class TestNodeCache extends BaseClassForTests @Override public Object call() throws Exception { - finalCache.rebuildTestExchanger.exchange(new Object(), 10, TimeUnit.SECONDS); + finalCache.rebuildTestExchanger.exchange(new Object(), timing2.forWaiting().seconds(), TimeUnit.SECONDS); // simulate another process updating the node while we're rebuilding client.setData().forPath("/test/snafu", "other".getBytes()); @@ -146,7 +148,7 @@ public class TestNodeCache extends BaseClassForTests ChildData currentData = finalCache.getCurrentData(); Assert.assertNotNull(currentData); - finalCache.rebuildTestExchanger.exchange(new Object(), 10, TimeUnit.SECONDS); + finalCache.rebuildTestExchanger.exchange(new Object(), timing2.forWaiting().seconds(), TimeUnit.SECONDS); return null; } @@ -155,7 +157,7 @@ public class TestNodeCache extends BaseClassForTests cache.start(false); future.get(); - Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); + Assert.assertTrue(timing2.awaitLatch(latch)); Assert.assertNotNull(cache.getCurrentData()); Assert.assertEquals(cache.getCurrentData().getData(), "other".getBytes()); }