From commits-return-29311-archive-asf-public=cust-asf.ponee.io@geode.apache.org Mon Nov 12 17:12:54 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id B35A1180660 for ; Mon, 12 Nov 2018 17:12:53 +0100 (CET) Received: (qmail 92523 invoked by uid 500); 12 Nov 2018 16:12:52 -0000 Mailing-List: contact commits-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list commits@geode.apache.org Received: (qmail 92514 invoked by uid 99); 12 Nov 2018 16:12:52 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Nov 2018 16:12:52 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 3E2D782BBE; Mon, 12 Nov 2018 16:12:52 +0000 (UTC) Date: Mon, 12 Nov 2018 16:12:51 +0000 To: "commits@geode.apache.org" Subject: [geode] branch develop updated: GEODE-4712: use assertJ in the await condition for better failure message (#2808) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154203917064.14699.4080463124990790257@gitbox.apache.org> From: jinmeiliao@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: geode X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Oldrev: 75d7ed8a49d64dd76bcab0a63bccad2e33539d84 X-Git-Newrev: 0b319d9623ce6517609d47c3e3cbe2c18f4355ea X-Git-Rev: 0b319d9623ce6517609d47c3e3cbe2c18f4355ea X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 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; }