GEODE-3113: Modify HARegionQueue test to use Awaitility vs. timeouts
This closes #645

* Modify test to use Awaitility (at most 60 seconds) vs. sleeps prior to 
checking expiration
* remove obsolete comment


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

Branch: refs/heads/feature/GEM-1483
Commit: 81c7014e0c0789cfeefe6d78b2bda4e23bf829f0
Parents: e2f79e5
Author: Lynn Hughes-Godfrey <lhughesgodf...@pivotal.io>
Authored: Tue Jul 18 13:48:24 2017 -0700
Committer: Lynn Hughes-Godfrey <lhughesgodf...@pivotal.io>
Committed: Wed Jul 19 17:36:18 2017 -0700

----------------------------------------------------------------------
 .../geode/internal/cache/ha/HARQAddOperationJUnitTest.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/81c7014e/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
index 8459cf6..71716dd 100755
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HARQAddOperationJUnitTest.java
@@ -21,11 +21,13 @@ import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.ha.HARegionQueue.MapWrapper;
 import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
 import org.apache.logging.log4j.Logger;
+import org.awaitility.Awaitility;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -286,13 +288,11 @@ public class HARQAddOperationJUnitTest {
           "ThreadIdentifier removed itself through expiry even though data was 
lying in the queue",
           eventsMap.get(threadId));
 
-      // wait for some more time to allow expiry on data
-      Thread.sleep(16000);
-
       // After the expiry of the data , AvaialbleIds size should be 0,
       // entry
       // removed from Region, LastDispatchedWrapperSet should have size 0.
-      assertEquals(0, regionqueue.getRegion().entrySet(false).size());
+      Awaitility.await().atMost(60, TimeUnit.SECONDS)
+          .until(() -> assertEquals(0, 
regionqueue.getRegion().entrySet(false).size()));
       assertEquals(0, regionqueue.getAvalaibleIds().size());
       assertNull(regionqueue.getCurrentCounterSet(id1));
 

Reply via email to