Skip to content

Commit 24a2bc3

Browse files
authored
Extend the selective muting of memory tests on Debian 8 (#67455)
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 1b6de28 commit 24a2bc3

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

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

Lines changed: 20 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.ClusterAdminClient;
@@ -129,6 +130,7 @@
129130
import org.elasticsearch.indices.IndicesRequestCache;
130131
import org.elasticsearch.indices.store.IndicesStore;
131132
import org.elasticsearch.ingest.IngestMetadata;
133+
import org.elasticsearch.monitor.os.OsInfo;
132134
import org.elasticsearch.node.NodeMocksPlugin;
133135
import org.elasticsearch.plugins.NetworkPlugin;
134136
import org.elasticsearch.plugins.Plugin;
@@ -2392,4 +2394,22 @@ public static String resolveCustomDataPath(String index) {
23922394
public static boolean inFipsJvm() {
23932395
return Boolean.parseBoolean(System.getProperty(FIPS_SYSPROP));
23942396
}
2397+
2398+
/**
2399+
* On Debian 8 the "memory" subsystem is not mounted by default
2400+
* when cgroups are enabled, and this confuses many versions of
2401+
* Java prior to Java 15. Tests that rely on machine memory
2402+
* being accurately determined will not work on such setups,
2403+
* and can use this method for selective muting.
2404+
* See https://github.com/elastic/elasticsearch/issues/67089
2405+
* and https://github.com/elastic/elasticsearch/issues/66885
2406+
*/
2407+
protected boolean willSufferDebian8MemoryProblem() {
2408+
final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet();
2409+
final boolean anyDebian8Nodes = response.getNodes()
2410+
.stream()
2411+
.anyMatch(ni -> ni.getInfo(OsInfo.class).getPrettyName().equals("Debian GNU/Linux 8 (jessie)"));
2412+
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
2413+
return anyDebian8Nodes && java15Plus == false;
2414+
}
23952415
}

x-pack/plugin/ml/src/internalClusterTest/java/org/elasticsearch/xpack/ml/integration/BasicDistributedJobsIT.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ public void testMlStateAndResultsIndicesNotAvailable() throws Exception {
423423
}
424424

425425
public void testCloseUnassignedLazyJobAndDatafeed() throws Exception {
426+
427+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
428+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
429+
426430
internalCluster().ensureAtLeastNumDataNodes(3);
427431
ensureStableCluster(3);
428432

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

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

374374
public void testJobRelocationIsMemoryAware() throws Exception {
375375

376+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
377+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
378+
376379
internalCluster().ensureAtLeastNumDataNodes(1);
377380
ensureStableCluster();
378381

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

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

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

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

0 commit comments

Comments
 (0)