geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sai_boorlaga...@apache.org
Subject [07/50] [abbrv] incubator-geode git commit: GEODE-988: CI Failure: CqPerfUsingPoolDUnitTest.testMatchingCqs failed with AssertionFailedError
Date Mon, 28 Mar 2016 17:45:14 GMT
GEODE-988: CI Failure: CqPerfUsingPoolDUnitTest.testMatchingCqs failed with AssertionFailedError

Test issue. The test is not waiting for events to arrive for all the CqListeners; it waits
for one of the CqListener (thae last one registered) and validates for all CqListener; based
on the order at which CQlistners are invoked (and thread scheduling), when check for expected
events are made, the events may not have arrived at all CqListeners.

Added wait logic in the Listner code, so that we wait for all the expected event to arrive.


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

Branch: refs/heads/feature/GEODE-52
Commit: 819339834edf4e8fc813574e5dbfbc954b0af2bc
Parents: cd8743d
Author: Anil <agingade@pivotal.io>
Authored: Wed Mar 23 10:57:21 2016 -0700
Committer: Anil <agingade@pivotal.io>
Committed: Fri Mar 25 12:11:27 2016 -0700

----------------------------------------------------------------------
 .../query/cq/dunit/CqQueryTestListener.java     | 31 ++++++++++++++++++++
 .../cq/dunit/CqQueryUsingPoolDUnitTest.java     | 17 ++++++-----
 2 files changed, 41 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/81933983/geode-core/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryTestListener.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryTestListener.java
b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryTestListener.java
index e402671..fe5e20f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryTestListener.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryTestListener.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
 
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.cache.Operation;
@@ -32,6 +33,7 @@ import com.gemstone.gemfire.cache.query.CqStatusListener;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.jayway.awaitility.Awaitility;
 
 /**
  * @author rmadduri
@@ -386,6 +388,35 @@ public class CqQueryTestListener implements CqStatusListener {
     return true;
   }
   
+  public void waitForEvents(
+      final int creates,
+      final int updates,
+      final int deletes,
+      final int queryInserts,
+      final int queryUpdates,
+      final int queryDeletes,
+      final int totalEvents) {
+    // Wait for expected events to arrive
+    try {
+      Awaitility.await().atMost(5, TimeUnit.SECONDS).until(() -> {
+        if ((creates > 0 && creates != this.getCreateEventCount()) ||
+            (updates > 0 && updates != this.getUpdateEventCount()) ||
+            (deletes > 0 && deletes != this.getDeleteEventCount()) ||
+            (queryInserts > 0 && queryInserts != this.getQueryInsertEventCount())
||
+            (queryUpdates > 0 && queryUpdates != this.getQueryUpdateEventCount())
||
+            (queryDeletes > 0 && queryDeletes != this.getQueryDeleteEventCount())
||
+            (totalEvents > 0 && totalEvents != this.getTotalEventCount())
+            ) {
+          return false;
+        }
+        return true;
+      });
+    } catch (Exception ex) {
+      // We just wait for expected events to arrive.
+      // Caller will do validation and throw exception.
+    }
+  }
+
 
   public void getEventHistory() {
     destroys.clear();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/81933983/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java
b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java
index be91665..506460c 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqQueryUsingPoolDUnitTest.java
@@ -1011,10 +1011,13 @@ public class CqQueryUsingPoolDUnitTest extends CacheTestCase {
         CqQueryTestListener listener = (CqQueryTestListener) cqListeners[0];
         listener.printInfo(false);
         
+        // Wait for expected events to arrive at Listener.
+        listener.waitForEvents(creates, updates, deletes, queryInserts, queryUpdates, queryDeletes,
totalEvents);
+        
         // Check for totalEvents count.
         if (totalEvents != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Total Event Count mismatch", totalEvents, listener.getTotalEventCount());
         }
         
@@ -1031,42 +1034,42 @@ public class CqQueryUsingPoolDUnitTest extends CacheTestCase {
         // Check for create count.
         if (creates != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Create Event mismatch", creates, listener.getCreateEventCount());
         }
         
         // Check for update count.
         if (updates != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Update Event mismatch", updates, listener.getUpdateEventCount());
         }
         
         // Check for delete count.
         if (deletes != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Delete Event mismatch", deletes, listener.getDeleteEventCount());
         }
         
         // Check for queryInsert count.
         if (queryInserts != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Query Insert Event mismatch", queryInserts, listener.getQueryInsertEventCount());
         }
         
         // Check for queryUpdate count.
         if (queryUpdates != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Query Update Event mismatch", queryUpdates, listener.getQueryUpdateEventCount());
         }
         
         // Check for queryDelete count.
         if (queryDeletes != noTest) {
           // Result size validation.
-          listener.printInfo(true);
+          //listener.printInfo(true);
           assertEquals("Query Delete Event mismatch", queryDeletes, listener.getQueryDeleteEventCount());
         }        
       }


Mime
View raw message