Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Awaitility to instead of Thread sheep method. #389

Merged
merged 2 commits into from Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions curator-framework/pom.xml
Expand Up @@ -86,6 +86,11 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Expand Up @@ -24,6 +24,7 @@
import org.apache.curator.utils.CloseableUtils;
import org.apache.zookeeper.ZooKeeper;
import java.util.concurrent.Callable;
import org.awaitility.Awaitility;

public class TestCleanState
{
Expand All @@ -43,10 +44,8 @@ public static void closeAndTestClean(CuratorFramework client)
EnsembleTracker ensembleTracker = internalClient.getEnsembleTracker();
if ( ensembleTracker != null )
{
while ( ensembleTracker.hasOutstanding() )
{
Thread.sleep(100);
}
Awaitility.await()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you are adding an implicit timeout of 10 seconds
I am fine with it, as far as it does not make the test become flaky

.until(() -> !ensembleTracker.hasOutstanding());
ensembleTracker.close();
}
ZooKeeper zooKeeper = internalClient.getZooKeeper();
Expand Down