geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zho...@apache.org
Subject incubator-geode git commit: GEODE-2120: The test needs to wait longer for compaction to finish.
Date Fri, 18 Nov 2016 00:32:56 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop ed7d9a8d1 -> c56554e3c


GEODE-2120: The test needs to wait longer for compaction to finish.


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

Branch: refs/heads/develop
Commit: c56554e3ccafddc06e87c903e3a3a0d7bd6c0650
Parents: ed7d9a8
Author: zhouxh <gzhou@pivotal.io>
Authored: Thu Nov 17 16:32:34 2016 -0800
Committer: zhouxh <gzhou@pivotal.io>
Committed: Thu Nov 17 16:32:34 2016 -0800

----------------------------------------------------------------------
 .../MultipleOplogsRollingFeatureJUnitTest.java  | 24 +++++---------------
 1 file changed, 6 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c56554e3/geode-core/src/test/java/org/apache/geode/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
index 1f61be3..c79f4fa 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
@@ -16,9 +16,13 @@ package org.apache.geode.internal.cache;
 
 import static org.junit.Assert.*;
 
+import java.util.concurrent.TimeUnit;
+
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.jayway.awaitility.Awaitility;
+
 import org.apache.geode.cache.Scope;
 import org.apache.geode.distributed.internal.DistributionConfig;
 import org.apache.geode.test.junit.categories.IntegrationTest;
@@ -78,7 +82,7 @@ public class MultipleOplogsRollingFeatureJUnitTest extends DiskRegionTestingBase
       addEntries(1 /* oplogNumber */, 50 /* byte array size */);
 
       ((LocalRegion) region).getDiskStore().forceCompaction();
-      waitForCompactor(3000/* wait for forceRolling to finish */);
+      Awaitility.waitAtMost(15, TimeUnit.SECONDS).until(()->FLAG==true);
       logWriter.info("testMultipleRolling after waitForCompactor");
       // the compactor copied two tombstone and 1 entry to oplog #2
       // The total oplog size will become 429, that why we need to
@@ -135,7 +139,7 @@ public class MultipleOplogsRollingFeatureJUnitTest extends DiskRegionTestingBase
     }
 
     // let the main thread sleep so that rolling gets over
-    waitForCompactor(5000);
+    Awaitility.waitAtMost(25, TimeUnit.SECONDS).until(()->FLAG==true);
 
     assertTrue("Number of Oplogs to be rolled is not null : this is unexpected",
         diskRegion.getOplogToBeCompacted() == null);
@@ -148,22 +152,6 @@ public class MultipleOplogsRollingFeatureJUnitTest extends DiskRegionTestingBase
     deleteFiles();
   }
 
-  private void waitForCompactor(long maxWaitingTime) {
-    long maxWaitTime = maxWaitingTime;
-    long start = System.currentTimeMillis();
-    while (!FLAG) { // wait until
-      // condition is met
-      assertTrue("Waited over " + maxWaitTime + "entry to get refreshed",
-          (System.currentTimeMillis() - start) < maxWaitTime);
-      try {
-        Thread.sleep(1);
-
-      } catch (InterruptedException ie) {
-        fail("Interrupted while waiting " + ie);
-      }
-    }
-  }
-
   private void addEntries(int opLogNum, int valueSize) {
     assertNotNull(region);
     byte[] val = new byte[valueSize];


Mime
View raw message