Return-Path: X-Original-To: apmail-flink-commits-archive@minotaur.apache.org Delivered-To: apmail-flink-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5D36418E24 for ; Mon, 13 Jul 2015 17:27:26 +0000 (UTC) Received: (qmail 71541 invoked by uid 500); 13 Jul 2015 16:59:26 -0000 Delivered-To: apmail-flink-commits-archive@flink.apache.org Received: (qmail 68540 invoked by uid 500); 13 Jul 2015 16:59:24 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 66404 invoked by uid 99); 13 Jul 2015 16:54:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2015 16:54:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3CCE9E058E; Mon, 13 Jul 2015 16:54:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sewen@apache.org To: commits@flink.apache.org Date: Mon, 13 Jul 2015 16:54:06 -0000 Message-Id: <4ce15678103d4bf493e0e2a58a74a398@git.apache.org> In-Reply-To: <9eeae8a9673a42ca9b0a541017431b18@git.apache.org> References: <9eeae8a9673a42ca9b0a541017431b18@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/7] flink git commit: [FLINK-2235] Fix tests to allow exception in 'EnvironmentInformationTest.getSizeOfFreeHeapMemory()' if Xmx is not set. [FLINK-2235] Fix tests to allow exception in 'EnvironmentInformationTest.getSizeOfFreeHeapMemory()' if Xmx is not set. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/b0b0cb50 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/b0b0cb50 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/b0b0cb50 Branch: refs/heads/master Commit: b0b0cb50d63e2f831196fc9219858467a07d8302 Parents: 910e8c4 Author: Stephan Ewen Authored: Mon Jul 13 16:22:04 2015 +0200 Committer: Stephan Ewen Committed: Mon Jul 13 17:54:31 2015 +0200 ---------------------------------------------------------------------- .../flink/runtime/util/EnvironmentInformationTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/b0b0cb50/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java index 771c57c..3890a81 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java @@ -30,12 +30,20 @@ public class EnvironmentInformationTest { public void testJavaMemory() { try { long fullHeap = EnvironmentInformation.getMaxJvmHeapMemory(); - long free = EnvironmentInformation.getSizeOfFreeHeapMemory(); long freeWithGC = EnvironmentInformation.getSizeOfFreeHeapMemoryWithDefrag(); assertTrue(fullHeap > 0); - assertTrue(free >= 0); assertTrue(freeWithGC >= 0); + + try { + long free = EnvironmentInformation.getSizeOfFreeHeapMemory(); + assertTrue(free >= 0); + } + catch (RuntimeException e) { + // this may only occur if the Xmx is not set + assertEquals(Long.MAX_VALUE, EnvironmentInformation.getMaxJvmHeapMemory()); + } + // we cannot make these assumptions, because the test JVM may grow / shrink during the GC // assertTrue(free <= fullHeap);