Skip to content
Permalink
Browse files
CURATOR-559 - more attempts to keep tests from failing. Make sure cou…
…nt is zeroed after server is stopped.
  • Loading branch information
randgalt committed Apr 21, 2020
1 parent 629486f commit 3d76a317b68839b83e298fdd48ead1a95e5f8fe8
Showing 1 changed file with 4 additions and 3 deletions.
@@ -44,7 +44,7 @@ public void testRecursingRetry() throws Exception
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 void testThreadedRecursingRetry() throws Exception
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 @@ private CuratorFramework newClient(AtomicInteger count)
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 @@ private void prep(CuratorFramework client) throws Exception
});
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

0 comments on commit 3d76a31

Please sign in to comment.