Skip to content

Commit 2943006

Browse files
Nicer java 15 plus check.
1 parent ed4cc8b commit 2943006

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.elasticsearch.xpack.autoscaling.action;
88

99
import org.apache.lucene.util.Constants;
10+
import org.elasticsearch.bootstrap.JavaVersion;
1011
import org.elasticsearch.env.NodeEnvironment;
1112
import org.elasticsearch.monitor.os.OsProbe;
1213
import org.elasticsearch.test.ESIntegTestCase;
@@ -28,10 +29,9 @@ public class TransportGetAutoscalingCapacityActionIT extends AutoscalingIntegTes
2829

2930
public void testCurrentCapacity() throws Exception {
3031
boolean looksLikeDebian8 = Constants.LINUX && Constants.OS_VERSION.startsWith("3.16.0");
31-
final StringTokenizer st = new StringTokenizer(JVM_SPEC_VERSION, ".");
32-
int major = Integer.parseInt(st.nextToken());
32+
boolean java15Plus = JavaVersion.current().compareTo(JavaVersion.parse("15")) >= 0;
3333
// see: https://github.com/elastic/elasticsearch/issues/67089#issuecomment-756114654
34-
assumeTrue("cannot run on debian 8 prior to java 15", major >= 15 || looksLikeDebian8 == false);
34+
assumeTrue("cannot run on debian 8 prior to java 15", java15Plus || looksLikeDebian8 == false);
3535

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

0 commit comments

Comments
 (0)