提交 b0b0cb50 编写于 作者: S Stephan Ewen

[FLINK-2235] Fix tests to allow exception in...

[FLINK-2235] Fix tests to allow exception in 'EnvironmentInformationTest.getSizeOfFreeHeapMemory()' if Xmx is not set.
上级 910e8c43
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册