Skip to content

Commit dad1e91

Browse files
authored
Extend the selective muting of memory tests on Debian 8 (#67456)
The selective muting implemented for autoscaling in #67159 is extended to the ML tests that also fail when machine memory is reported as 0. Most of the logic to determine when memory will not be accurately reported is now in a utility method in the base class. Relates #66885 Backport of #67422
1 parent ef6f94f commit dad1e91

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.elasticsearch.action.search.SearchResponse;
5858
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
5959
import org.elasticsearch.action.support.IndicesOptions;
60+
import org.elasticsearch.bootstrap.JavaVersion;
6061
import org.elasticsearch.client.AdminClient;
6162
import org.elasticsearch.client.Client;
6263
import org.elasticsearch.client.Requests;
@@ -2350,4 +2351,22 @@ public static Index resolveIndex(String index) {
23502351
public static boolean inFipsJvm() {
23512352
return Security.getProviders()[0].getName().toLowerCase(Locale.ROOT).contains("fips");
23522353
}
2354+
2355+
/**
2356+
* On Debian 8 the "memory" subsystem is not mounted by default
2357+
* when cgroups are enabled, and this confuses many versions of
2358+
* Java prior to Java 15. Tests that rely on machine memory
2359+
* being accurately determined will not work on such setups,
2360+
* and can use this method for selective muting.
2361+
* See https://github.com/elastic/elasticsearch/issues/67089
2362+
* and https://github.com/elastic/elasticsearch/issues/66885
2363+
*/
2364+
protected boolean willSufferDebian8MemoryProblem() {
2365+
final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet();
2366+
final boolean anyDebian8Nodes = response.getNodes()
2367+
.stream()
2368+
.anyMatch(ni -> ni.getOs().getPrettyName().equals("Debian GNU/Linux 8 (jessie)"));
2369+
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
2370+
return anyDebian8Nodes && java15Plus == false;
2371+
}
23532372
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ public void testStopAndForceStopDatafeed() throws Exception {
337337

338338
public void testJobRelocationIsMemoryAware() throws Exception {
339339

340+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
341+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
342+
340343
internalCluster().ensureAtLeastNumDataNodes(1);
341344
ensureStableClusterOnAllNodes(1);
342345

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/TooManyJobsIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,14 @@ public void testLazyNodeValidation() throws Exception {
124124
}
125125

126126
public void testSingleNode() throws Exception {
127+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
128+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
127129
verifyMaxNumberOfJobsLimit(1, randomIntBetween(1, 20));
128130
}
129131

130132
public void testMultipleNodes() throws Exception {
133+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
134+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
131135
verifyMaxNumberOfJobsLimit(3, randomIntBetween(1, 20));
132136
}
133137

0 commit comments

Comments
 (0)