Skip to content

Commit

Permalink
Extend the selective muting of memory tests on Debian 8 (#67456)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
droberts195 authored Jan 13, 2021
1 parent ef6f94f commit dad1e91
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit dad1e91

Please sign in to comment.