You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2020/04/19 19:55:10 UTC
[curator] 01/01: CURATOR-559 - more attempts to keep tests from
failing. Make sure count is zeroed after server is stopped.
This is an automated email from the ASF dual-hosted git repository.
randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git
commit 320b6e1d76493ca8c82df6ea30bbeb1f272960ee
Author: randgalt <ra...@apache.org>
AuthorDate: Sun Apr 19 14:54:04 2020 -0500
CURATOR-559 - more attempts to keep tests from failing. Make sure count is zeroed after server is stopped.
---
.../org/apache/curator/connection/TestThreadLocalRetryLoop.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 56362e6..686109c 100644
--- a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -44,7 +44,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
AtomicInteger count = new AtomicInteger();
try (CuratorFramework client = newClient(count))
{
- prep(client);
+ prep(client, count);
doOperation(client);
Assert.assertEquals(count.get(), retryCount + 1); // Curator's retry policy has been off by 1 since inception - we might consider fixing it someday
}
@@ -58,7 +58,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
AtomicInteger count = new AtomicInteger();
try (CuratorFramework client = newClient(count))
{
- prep(client);
+ prep(client, count);
for ( int i = 0; i < threadQty; ++i )
{
executorService.submit(() -> doOperation(client));
@@ -82,7 +82,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
return CuratorFrameworkFactory.newClient(server.getConnectString(), 100, 100, retryPolicy);
}
- private void prep(CuratorFramework client) throws Exception
+ private void prep(CuratorFramework client, AtomicInteger count) throws Exception
{
client.start();
client.create().forPath("/test");
@@ -94,6 +94,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
});
server.stop();
Assert.assertTrue(timing.awaitLatch(lostLatch));
+ count.set(0); // in case the server shutdown incremented the count
}
private Void doOperation(CuratorFramework client) throws Exception