Skip to content

Commit b2f6202

Browse files
authored
Extend the selective muting of memory tests on Debian 8 (#67422)
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
1 parent c20b92f commit b2f6202

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
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
@@ -56,6 +56,7 @@
5656
import org.elasticsearch.action.search.SearchResponse;
5757
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
5858
import org.elasticsearch.action.support.IndicesOptions;
59+
import org.elasticsearch.bootstrap.JavaVersion;
5960
import org.elasticsearch.client.AdminClient;
6061
import org.elasticsearch.client.Client;
6162
import org.elasticsearch.client.ClusterAdminClient;
@@ -120,6 +121,7 @@
120121
import org.elasticsearch.indices.IndicesQueryCache;
121122
import org.elasticsearch.indices.IndicesRequestCache;
122123
import org.elasticsearch.indices.store.IndicesStore;
124+
import org.elasticsearch.monitor.os.OsInfo;
123125
import org.elasticsearch.node.NodeMocksPlugin;
124126
import org.elasticsearch.plugins.NetworkPlugin;
125127
import org.elasticsearch.plugins.Plugin;
@@ -2232,4 +2234,22 @@ public static String resolveCustomDataPath(String index) {
22322234
public static boolean inFipsJvm() {
22332235
return Boolean.parseBoolean(System.getProperty(FIPS_SYSPROP));
22342236
}
2237+
2238+
/**
2239+
* On Debian 8 the "memory" subsystem is not mounted by default
2240+
* when cgroups are enabled, and this confuses many versions of
2241+
* Java prior to Java 15. Tests that rely on machine memory
2242+
* being accurately determined will not work on such setups,
2243+
* and can use this method for selective muting.
2244+
* See https://github.com/elastic/elasticsearch/issues/67089
2245+
* and https://github.com/elastic/elasticsearch/issues/66885
2246+
*/
2247+
protected boolean willSufferDebian8MemoryProblem() {
2248+
final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet();
2249+
final boolean anyDebian8Nodes = response.getNodes()
2250+
.stream()
2251+
.anyMatch(ni -> ni.getInfo(OsInfo.class).getPrettyName().equals("Debian GNU/Linux 8 (jessie)"));
2252+
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
2253+
return anyDebian8Nodes && java15Plus == false;
2254+
}
22352255
}

x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/action/TransportGetAutoscalingCapacityActionIT.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
package org.elasticsearch.xpack.autoscaling.action;
88

9-
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
10-
import org.elasticsearch.bootstrap.JavaVersion;
119
import org.elasticsearch.env.NodeEnvironment;
12-
import org.elasticsearch.monitor.os.OsInfo;
1310
import org.elasticsearch.monitor.os.OsProbe;
1411
import org.elasticsearch.test.ESIntegTestCase;
1512
import org.elasticsearch.xpack.autoscaling.AutoscalingIntegTestCase;
@@ -27,13 +24,8 @@
2724
public class TransportGetAutoscalingCapacityActionIT extends AutoscalingIntegTestCase {
2825

2926
public void testCurrentCapacity() throws Exception {
30-
final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet();
31-
final boolean anyDebian8Nodes = response.getNodes()
32-
.stream()
33-
.anyMatch(ni -> ni.getInfo(OsInfo.class).getPrettyName().equals("Debian GNU/Linux 8 (jessie)"));
34-
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
3527
// see: https://github.com/elastic/elasticsearch/issues/67089#issuecomment-756114654
36-
assumeTrue("cannot run on debian 8 prior to java 15", java15Plus || anyDebian8Nodes == false);
28+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
3729

3830
assertThat(capacity().results().keySet(), Matchers.empty());
3931
long memory = OsProbe.getInstance().getTotalPhysicalMemorySize();

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
@@ -420,6 +420,10 @@ public void testMlStateAndResultsIndicesNotAvailable() throws Exception {
420420
}
421421

422422
public void testCloseUnassignedLazyJobAndDatafeed() throws Exception {
423+
424+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
425+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
426+
423427
internalCluster().ensureAtLeastNumDataNodes(3);
424428
ensureStableCluster(3);
425429

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
@@ -397,6 +397,9 @@ public void testStopAndForceStopDatafeed() throws Exception {
397397

398398
public void testJobRelocationIsMemoryAware() throws Exception {
399399

400+
// see: https://github.com/elastic/elasticsearch/issues/66885#issuecomment-758790179
401+
assumeFalse("cannot run on debian 8 prior to java 15", willSufferDebian8MemoryProblem());
402+
400403
internalCluster().ensureAtLeastNumDataNodes(1);
401404
ensureStableCluster();
402405

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)