Revert "Update monitor probe tests for java 9: this stuff is no longer accessible"

This reverts commit af2df9aef6.
This commit is contained in:
Robert Muir 2015-09-11 22:21:02 -04:00
parent 1f04182b81
commit 8be7fde181
3 changed files with 15 additions and 28 deletions

View File

@ -227,7 +227,6 @@ public class OsStats implements Streamable, ToXContent {
}
}
// TODO: if values are -1, this should return -1 to show its unsupported?
private static short calculatePercentage(long used, long max) {
return max <= 0 ? 0 : (short) (Math.round((100d * used) / max));
}

View File

@ -54,14 +54,11 @@ public class OsProbeTests extends ESTestCase {
}
assertNotNull(stats.getMem());
// TODO: once java 9 is sorted out make these hard checks (currently 9-ea and 9-ea-jigsaw will differ)
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
assertThat(stats.getMem().getTotal().bytes(), greaterThan(0L));
assertThat(stats.getMem().getFree().bytes(), greaterThan(0L));
assertThat(stats.getMem().getFreePercent(), allOf(greaterThanOrEqualTo((short) 0), lessThanOrEqualTo((short) 100)));
assertThat(stats.getMem().getUsed().bytes(), greaterThan(0L));
assertThat(stats.getMem().getUsedPercent(), allOf(greaterThanOrEqualTo((short) 0), lessThanOrEqualTo((short) 100)));
}
assertThat(stats.getMem().getTotal().bytes(), greaterThan(0L));
assertThat(stats.getMem().getFree().bytes(), greaterThan(0L));
assertThat(stats.getMem().getFreePercent(), allOf(greaterThanOrEqualTo((short) 0), lessThanOrEqualTo((short) 100)));
assertThat(stats.getMem().getUsed().bytes(), greaterThan(0L));
assertThat(stats.getMem().getUsedPercent(), allOf(greaterThanOrEqualTo((short) 0), lessThanOrEqualTo((short) 100)));
assertNotNull(stats.getSwap());
assertNotNull(stats.getSwap().getTotal());
@ -73,12 +70,9 @@ public class OsProbeTests extends ESTestCase {
assertThat(stats.getSwap().getUsed().bytes(), greaterThanOrEqualTo(0L));
} else {
// On platforms with no swap
// TODO: one java 9 is sorted out make these hard checks (currently 9-ea and 9-ea-jigsaw will differ)
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
assertThat(stats.getSwap().getTotal().bytes(), equalTo(0L));
assertThat(stats.getSwap().getFree().bytes(), equalTo(0L));
assertThat(stats.getSwap().getUsed().bytes(), equalTo(0L));
}
assertThat(stats.getSwap().getTotal().bytes(), equalTo(0L));
assertThat(stats.getSwap().getFree().bytes(), equalTo(0L));
assertThat(stats.getSwap().getUsed().bytes(), equalTo(0L));
}
}
}

View File

@ -51,11 +51,8 @@ public class ProcessProbeTests extends ESTestCase {
assertThat(stats.getOpenFileDescriptors(), equalTo(-1L));
assertThat(stats.getMaxFileDescriptors(), equalTo(-1L));
} else {
// TODO: once java 9 is sorted out make these hard checks (currently 9-ea and 9-ea-jigsaw will differ)
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
assertThat(stats.getOpenFileDescriptors(), greaterThan(0L));
assertThat(stats.getMaxFileDescriptors(), greaterThan(0L));
}
assertThat(stats.getOpenFileDescriptors(), greaterThan(0L));
assertThat(stats.getMaxFileDescriptors(), greaterThan(0L));
}
ProcessStats.Cpu cpu = stats.getCpu();
@ -65,14 +62,11 @@ public class ProcessProbeTests extends ESTestCase {
assertThat(cpu.getPercent(), anyOf(lessThan((short) 0), allOf(greaterThanOrEqualTo((short) 0), lessThanOrEqualTo((short) 100))));
// CPU time can return -1 if the the platform does not support this operation, let's see which platforms fail
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
// TODO: once java 9 is sorted out make these hard checks (currently 9-ea and 9-ea-jigsaw will differ)
assertThat(cpu.total, greaterThan(0L));
assertThat(cpu.total, greaterThan(0L));
ProcessStats.Mem mem = stats.getMem();
assertNotNull(mem);
// Commited total virtual memory can return -1 if not supported, let's see which platforms fail
assertThat(mem.totalVirtual, greaterThan(0L));
}
ProcessStats.Mem mem = stats.getMem();
assertNotNull(mem);
// Commited total virtual memory can return -1 if not supported, let's see which platforms fail
assertThat(mem.totalVirtual, greaterThan(0L));
}
}