diff --git a/server/src/test/java/org/elasticsearch/monitor/os/OsProbeTests.java b/server/src/test/java/org/elasticsearch/monitor/os/OsProbeTests.java index ac802cf738500..43c94b6154069 100644 --- a/server/src/test/java/org/elasticsearch/monitor/os/OsProbeTests.java +++ b/server/src/test/java/org/elasticsearch/monitor/os/OsProbeTests.java @@ -143,8 +143,11 @@ public void testOsStats() { assertThat(stats.getCgroup().getCpuStat().getTimeThrottledNanos(), greaterThanOrEqualTo(0L)); // These could be null if transported from a node running an older version, but shouldn't be null on the current node assertThat(stats.getCgroup().getMemoryControlGroup(), notNullValue()); - assertThat(stats.getCgroup().getMemoryLimitInBytes(), notNullValue()); - assertThat(new BigInteger(stats.getCgroup().getMemoryLimitInBytes()), greaterThan(BigInteger.ZERO)); + String memoryLimitInBytes = stats.getCgroup().getMemoryLimitInBytes(); + assertThat(memoryLimitInBytes, notNullValue()); + if (memoryLimitInBytes.equals("max") == false) { + assertThat(new BigInteger(memoryLimitInBytes), greaterThan(BigInteger.ZERO)); + } assertThat(stats.getCgroup().getMemoryUsageInBytes(), notNullValue()); assertThat(new BigInteger(stats.getCgroup().getMemoryUsageInBytes()), greaterThan(BigInteger.ZERO)); }