geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [geode] branch develop updated: GEODE-5499: Changing testTxRmtMirror to use awaitility, not 200 ms sleep
Date Tue, 07 Aug 2018 20:48:59 GMT
This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 946ec0e  GEODE-5499: Changing testTxRmtMirror to use awaitility, not 200 ms sleep
946ec0e is described below

commit 946ec0ebf5553a4e5dbf45cbf08c29dbfc1bd68d
Author: Dan Smith <dsmith@pivotal.io>
AuthorDate: Tue Aug 7 13:48:55 2018 -0700

    GEODE-5499: Changing testTxRmtMirror to use awaitility, not 200 ms sleep
---
 .../geode/cache30/MultiVMRegionTestCase.java       | 69 ++++++++++------------
 1 file changed, 31 insertions(+), 38 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
b/geode-core/src/integrationTest/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
index 7338eb7..b63a6ef 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache30/MultiVMRegionTestCase.java
@@ -47,8 +47,10 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.Logger;
+import org.awaitility.Awaitility;
 import org.junit.AfterClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -7306,6 +7308,33 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase
{
             }
           }
         };
+
+
+
+    Region region;
+
+    // Make sure that a remote create done in a tx is created in a remote mirror
+    // and dropped in a remote non-mirror
+    VM vm0 = VM.getVM(0);
+    VM vm1 = VM.getVM(1);
+    vm0.invoke(createMirror);
+    vm1.invoke(createNonMirror);
+    region = createRegion(rgnName);
+
+    txMgr.begin();
+    region.create("key", "value");
+    getSystem().getLogWriter().info("textTXRmtMirror: create mirror and non-mirror");
+    txMgr.commit();
+
+    if (!region.getAttributes().getScope().isAck()) {
+      Awaitility.await().atMost(5, TimeUnit.MINUTES)
+          .until(() -> validateTXRmtMirror(rgnName, vm0, vm1));
+    } else {
+      validateTXRmtMirror(rgnName, vm0, vm1);
+    }
+  }
+
+  private void validateTXRmtMirror(String rgnName, VM vm0, VM vm1) {
     SerializableRunnable checkExists = new SerializableRunnable("textTXRmtMirror: checkExists")
{
       @Override
       public void run() {
@@ -7360,44 +7389,8 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase
{
         assertEquals(rgn.getCache(), tl.lastEvent.getCache());
       }
     };
-
-
-    // GemFireVersion.waitForJavaDebugger(getLogWriter(), "CTRLR WAITING AFTER CREATE");
-
-    try {
-      Region rgn;
-
-      // Make sure that a remote create done in a tx is created in a remote mirror
-      // and dropped in a remote non-mirror
-      Host.getHost(0).getVM(0).invoke(createMirror);
-      Host.getHost(0).getVM(1).invoke(createNonMirror);
-      rgn = createRegion(rgnName);
-
-      txMgr.begin();
-      rgn.create("key", "value");
-      // TransactionId txId = txMgr.getTransactionId();
-      getSystem().getLogWriter().info("textTXRmtMirror: create mirror and non-mirror");
-      txMgr.commit();
-      if (!rgn.getAttributes().getScope().isAck()) {
-        // pause to give cmt message a chance to be processed
-        try {
-          Thread.sleep(200);
-        } catch (InterruptedException chomp) {
-          fail("interrupted");
-        }
-      }
-      Host.getHost(0).getVM(0).invoke(checkExists);
-      Host.getHost(0).getVM(1).invoke(checkNoKey);
-      rgn.destroyRegion();
-
-      // @todo darrel/mitch: how do a get rid of the entry remotely
-      // Make sure that a remote put, that modifies an existing entry,
-      // done in a tx is dropped in a remote mirror that does not have the entry.
-    } catch (Exception e) {
-      getCache().close();
-      getSystem().getLogWriter().fine("textTXRmtMirror: Caused exception in createRegion");
-      throw e;
-    }
+    vm0.invoke(checkExists);
+    vm1.invoke(checkNoKey);
   }
 
   @Ignore("TODO: test is disabled")


Mime
View raw message