From 8782f0b73822b333e756fe5a61d7a677b5eadaca Mon Sep 17 00:00:00 2001 From: eshu Date: Mon, 22 May 2017 16:00:50 -0700 Subject: [PATCH] GEODE-2916: Fix a flaky timing issue. --- .../apache/geode/internal/cache/CacheAdvisorDUnitTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java index 2dcf8e9cf377..7a84dbc5fc7d 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/cache/CacheAdvisorDUnitTest.java @@ -22,12 +22,14 @@ import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase; import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase; import org.apache.geode.test.junit.categories.DistributedTest; +import org.awaitility.Awaitility; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.TimeUnit; import org.apache.geode.cache.AttributesFactory; import org.apache.geode.cache.AttributesMutator; @@ -222,7 +224,9 @@ public void close() {} }); } - assertEquals(expected, rgn.getCacheDistributionAdvisor().adviseNetLoad()); + Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS) + .atMost(30, TimeUnit.SECONDS) + .until(() -> assertEquals(expected, rgn.getCacheDistributionAdvisor().adviseNetLoad())); } /**