diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java index 04477e2c117ba..7759618347e3f 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java @@ -57,6 +57,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.DefaultShardOperationFailedException; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.bootstrap.JavaVersion; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; @@ -2350,4 +2351,22 @@ public static Index resolveIndex(String index) { public static boolean inFipsJvm() { return Security.getProviders()[0].getName().toLowerCase(Locale.ROOT).contains("fips"); } + + /** + * On Debian 8 the "memory" subsystem is not mounted by default + * when cgroups are enabled, and this confuses many versions of + * Java prior to Java 15. Tests that rely on machine memory + * being accurately determined will not work on such setups, + * and can use this method for selective muting. + * See https://github.com/elastic/elasticsearch/issues/67089 + * and https://github.com/elastic/elasticsearch/issues/66885 + */ + protected boolean willSufferDebian8MemoryProblem() { + final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet(); + final boolean anyDebian8Nodes = response.getNodes() + .stream() + .anyMatch(ni -> ni.getOs().getPrettyName().equals("Debian GNU/Linux 8 (jessie)")); + boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0; + return anyDebian8Nodes && java15Plus == false; + } } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java index 940b219aac881..2b2a1b9cb7f06 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java @@ -337,6 +337,9 @@ public void testStopAndForceStopDatafeed() throws Exception { public void testJobRelocationIsMemoryAware() throws Exception { + // see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179 + assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem()); + internalCluster().ensureAtLeastNumDataNodes(1); ensureStableClusterOnAllNodes(1); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java index f79e9f1e4e945..0beae14be954f 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java @@ -124,10 +124,14 @@ public void testLazyNodeValidation() throws Exception { } public void testSingleNode() throws Exception { + // see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179 + assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem()); verifyMaxNumberOfJobsLimit(1, randomIntBetween(1, 20)); } public void testMultipleNodes() throws Exception { + // see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179 + assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem()); verifyMaxNumberOfJobsLimit(3, randomIntBetween(1, 20)); }