You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2018/11/22 00:35:00 UTC

[geode] branch develop updated: GEODE-5943: cleanup vm before each test (#2889)

This is an automated email from the ASF dual-hosted git repository.

jinmeiliao 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 3a3697d  GEODE-5943: cleanup vm before each test (#2889)
3a3697d is described below

commit 3a3697de5bcc4b709a8119399ee3b4e3f5276375
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Wed Nov 21 16:34:52 2018 -0800

    GEODE-5943: cleanup vm before each test (#2889)
---
 .../geode/internal/cache/eviction/EvictionDUnitTest.java       | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/eviction/EvictionDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/eviction/EvictionDUnitTest.java
index eb929a1..0e13301 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/eviction/EvictionDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/eviction/EvictionDUnitTest.java
@@ -24,6 +24,7 @@ import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ThreadPoolExecutor;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -84,6 +85,7 @@ public class EvictionDUnitTest {
     if (offHeap) {
       properties.setProperty(OFF_HEAP_MEMORY_SIZE, "200m");
     }
+
     server0 = cluster.startServerVM(0, s -> s.withNoCacheServer()
         .withProperties(properties).withConnectionToLocator(locatorPort));
     server1 = cluster.startServerVM(1, s -> s.withNoCacheServer()
@@ -102,6 +104,14 @@ public class EvictionDUnitTest {
     }, server0, server1);
   }
 
+  @After
+  public void tearDown() throws Exception {
+    // this test is asserting on the expected number of evictions depending on the current memory
+    // usage, so we need to make sure each test start with clean memory usage to reduce flakiness
+    server0.getVM().bounce();
+    server1.getVM().bounce();
+  }
+
   @Test
   public void testDummyInlineNCentralizedEviction() {
     VMProvider.invokeInEveryMember("create region", () -> {