Skip to content

Commit 90fad32

Browse files
improved debian 8 check.
1 parent 768d0fe commit 90fad32

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

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

9-
import org.apache.lucene.util.Constants;
9+
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
1010
import org.elasticsearch.bootstrap.JavaVersion;
1111
import org.elasticsearch.env.NodeEnvironment;
12+
import org.elasticsearch.monitor.os.OsInfo;
1213
import org.elasticsearch.monitor.os.OsProbe;
1314
import org.elasticsearch.test.ESIntegTestCase;
1415
import org.elasticsearch.xpack.autoscaling.AutoscalingIntegTestCase;
@@ -26,10 +27,12 @@
2627
public class TransportGetAutoscalingCapacityActionIT extends AutoscalingIntegTestCase {
2728

2829
public void testCurrentCapacity() throws Exception {
29-
boolean looksLikeDebian8 = Constants.LINUX && Constants.OS_VERSION.startsWith("3.16.0");
30+
final NodesInfoResponse response = client().admin().cluster().prepareNodesInfo().execute().actionGet();
31+
final boolean anyDebian8Nodes =
32+
response.getNodes().stream().anyMatch(ni -> ni.getInfo(OsInfo.class).getPrettyName().equals("Debian GNU/Linux 8 (jessie)"));
3033
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
3134
// see: https://github.com/elastic/elasticsearch/issues/67089#issuecomment-756114654
32-
assumeTrue("cannot run on debian 8 prior to java 15", java15Plus || looksLikeDebian8 == false);
35+
assumeTrue("cannot run on debian 8 prior to java 15", java15Plus || anyDebian8Nodes == false);
3336

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

0 commit comments

Comments
 (0)