geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-4712: use assertJ in the await condition for better failure message (#2808)
Date Mon, 12 Nov 2018 16:12:51 GMT
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 0b319d9  GEODE-4712: use assertJ in the await condition for better failure message
(#2808)
0b319d9 is described below

commit 0b319d9623ce6517609d47c3e3cbe2c18f4355ea
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Mon Nov 12 08:12:39 2018 -0800

    GEODE-4712: use assertJ in the await condition for better failure message (#2808)
---
 .../internal/cache/eviction/EvictionDUnitTest.java      | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

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 635610b..ec4e022 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
@@ -14,7 +14,6 @@
  */
 package org.apache.geode.internal.cache.eviction;
 
-import static java.lang.Math.abs;
 import static org.apache.geode.distributed.ConfigurationProperties.OFF_HEAP_MEMORY_SIZE;
 import static org.assertj.core.api.Assertions.assertThat;
 
@@ -124,12 +123,6 @@ public class EvictionDUnitTest {
     int server0ExpectedEviction = server0.invoke(() -> sendEventAndWaitForExpectedEviction("PR1"));
     int server1ExpectedEviction = server1.invoke(() -> sendEventAndWaitForExpectedEviction("PR1"));
 
-    Long server0EvictionCount = server0.invoke(() -> getActualEviction("PR1"));
-    Long server1EvictionCount = server1.invoke(() -> getActualEviction("PR1"));
-
-    assertThat(server0EvictionCount + server1EvictionCount)
-        .isEqualTo(server0ExpectedEviction + server1ExpectedEviction);
-
     // do 4 puts again in PR1
     server0.invoke(() -> {
       Region region = ClusterStartupRule.getCache().getRegion("PR1");
@@ -138,8 +131,8 @@ public class EvictionDUnitTest {
       }
     });
 
-    server0EvictionCount = server0.invoke(() -> getActualEviction("PR1"));
-    server1EvictionCount = server1.invoke(() -> getActualEviction("PR1"));
+    long server0EvictionCount = server0.invoke(() -> getActualEviction("PR1"));
+    long server1EvictionCount = server1.invoke(() -> getActualEviction("PR1"));
 
     assertThat(server0EvictionCount + server1EvictionCount)
         .isEqualTo(4 + server0ExpectedEviction + server1ExpectedEviction);
@@ -214,9 +207,7 @@ public class EvictionDUnitTest {
         dr1.put(counter, new byte[ENTRY_SIZE]);
       }
 
-      int expectedEviction = sendEventAndWaitForExpectedEviction("DR1");
-
-      assertThat(dr1.getTotalEvictions()).isEqualTo(expectedEviction);
+      sendEventAndWaitForExpectedEviction("DR1");
     });
   }
 
@@ -246,7 +237,7 @@ public class EvictionDUnitTest {
     int expectedEviction = (int) Math.ceil((double) totalBytesToEvict / (double) entrySize);
 
     GeodeAwaitility.await()
-        .until(() -> (abs(region.getTotalEvictions() - expectedEviction) <= 1));
+        .untilAsserted(() -> assertThat(region.getTotalEvictions()).isEqualTo(expectedEviction));
     return expectedEviction;
   }
 


Mime
View raw message