Repository: incubator-geode Updated Branches: refs/heads/develop 59fa50d4f -> 60266fd56
GEODE-559: CI Failure: ClientInterestNotifyDUnitTest.testInterestNotify failed Test issue. Before validation test checks to see if the events are drained on the server side, but doesn't count for time taken to receive the event on client side and invoke its cache listener. Based on the machine speed and thread invocation timing, this test can intermediately fail. Added wait logic at client side CacheListener. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/60266fd5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/60266fd5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/60266fd5 Branch: refs/heads/develop Commit: 60266fd56b1aa6a541387a3e539692d4f1bc2c9b Parents: 59fa50d Author: Anil <[email protected]> Authored: Fri Mar 18 14:10:53 2016 -0700 Committer: Anil <[email protected]> Committed: Mon Mar 21 14:23:27 2016 -0700 ---------------------------------------------------------------------- .../sockets/ClientInterestNotifyDUnitTest.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/60266fd5/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java index 8a6cd35..62ce0b5 100755 --- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java @@ -18,6 +18,7 @@ package com.gemstone.gemfire.internal.cache.tier.sockets; import java.util.Iterator; import java.util.Properties; +import java.util.concurrent.TimeUnit; import com.gemstone.gemfire.cache.AttributesFactory; import com.gemstone.gemfire.cache.Cache; @@ -47,6 +48,7 @@ import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.VM; import com.gemstone.gemfire.test.dunit.Wait; import com.gemstone.gemfire.test.dunit.WaitCriterion; +import com.jayway.awaitility.Awaitility; /** * This test verifies the per-client notify-by-subscription (NBS) override @@ -101,6 +103,16 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase // validate expected event counts with actual counted public void validate(int creates, int updates, int invalidates, int destroys) { + // Wait for the last destroy event to arrive. + try { + Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> { + return (destroys == m_destroys); + }); + } catch (Exception ex) { + // The event is not received in a given wait time. + // The check will be done below to report the valid reason. + } + GemFireCacheImpl.getInstance().getLogger().info(m_name + ": creates: expected="+creates+", actual="+m_creates); GemFireCacheImpl.getInstance().getLogger().info(m_name + @@ -110,10 +122,10 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase GemFireCacheImpl.getInstance().getLogger().info(m_name + ": destroys: expected="+destroys+", actual="+m_destroys); - assertEquals(creates, m_creates); - assertEquals(updates, m_updates); - assertEquals(invalidates, m_invalidates); - assertEquals(destroys, m_destroys); + assertEquals("Creates :", creates, m_creates); + assertEquals("Updates :", updates, m_updates); + assertEquals("Invalidates :", invalidates, m_invalidates); + assertEquals("Destroys :", destroys, m_destroys); } }
