geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject incubator-geode git commit: GEODE-399: Fixing race with stats in testNetSearchNormals
Date Mon, 19 Oct 2015 18:01:37 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 29145d2e4 -> 205061005


GEODE-399: Fixing race with stats in testNetSearchNormals

Some messages may not be done processing when the get completes. The
test already had code to wait for one of the messages to show up, I've
applied that wait to the rest of the assertions.


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

Branch: refs/heads/feature/GEODE-409
Commit: 2050610051037fca513b722659962ee851f2fc23
Parents: 29145d2
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Mon Oct 19 10:49:40 2015 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Mon Oct 19 10:58:21 2015 -0700

----------------------------------------------------------------------
 .../cache/NetSearchMessagingDUnitTest.java      | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/20506100/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
index cf10dc6..6763cb9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
@@ -102,7 +102,6 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
     
   }
   
-  
   public void testNetSearchNormals() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -125,7 +124,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
       assertEquals(null, get(vm3, "a"));
 
       //Make sure we only processed one message
-      assertEquals(vm3Count + 3, getReceivedMessages(vm3));
+      waitForReceivedMessages(vm3, vm3Count + 3);
 
       //Make sure the normal guys each saw 1 query message.
       assertEquals(vm0Count + vm1Count + vm2Count + 3, getReceivedMessages(vm0) + getReceivedMessages(vm1)
+ getReceivedMessages(vm2));
@@ -144,17 +143,9 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
       assertEquals("b", get(vm3, "a"));
 
       //Make sure we only processed one message
-      assertEquals(vm2Count + 1, getReceivedMessages(vm2));
+      waitForReceivedMessages(vm2, vm2Count + 1);
 
-      //Make sure we only processed one message
-      DistributedTestCase.waitForCriterion(new WaitCriterion() {
-        public boolean done() {
-          return getReceivedMessages(vm3) == vm3Count + 3;
-        }
-        public String description() {
-          return "expected " + (vm3Count+3) + " but was " + getReceivedMessages(vm3);
-        }
-      }, 2000, 100, true);
+      waitForReceivedMessages(vm3, vm3Count + 3);
 
       //Make sure the normal guys each saw 1 query message.
       assertEquals(vm0Count + vm1Count + vm2Count + 3, getReceivedMessages(vm0) + getReceivedMessages(vm1)
+ getReceivedMessages(vm2));
@@ -353,6 +344,21 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
     });
   }
   
+  private void waitForReceivedMessages(VM vm, long expected) {
+    waitForCriterion(new WaitCriterion() {
+      
+      @Override
+      public boolean done() {
+        return getReceivedMessages(vm) == expected;
+      }
+      
+      @Override
+      public String description() {
+        return "Expected " + expected + " but got " + getReceivedMessages(vm);
+      }
+    }, 2000, 100, true);
+  }
+  
   private long getReceivedMessages(VM vm) {
     return ((Long) vm.invoke(new SerializableCallable() {
       


Mime
View raw message