You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/12/12 22:36:13 UTC
[10/46] geode git commit: GEODE-2120: The test needs to wait longer
for compaction to finish.
GEODE-2120: The test needs to wait longer for compaction to finish.
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c56554e3
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c56554e3
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c56554e3
Branch: refs/heads/feature/GEODE-1930
Commit: c56554e3ccafddc06e87c903e3a3a0d7bd6c0650
Parents: ed7d9a8
Author: zhouxh <gz...@pivotal.io>
Authored: Thu Nov 17 16:32:34 2016 -0800
Committer: zhouxh <gz...@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/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];