Skip to content

Commit f64efbd

Browse files
Use PLATINUM as license level for spatial features (#125802)
The random license selection in #125584 was incorrectly assuming ENTERPRISE was needed, when it should have been PLATINUM. This resulted in occasional test failures (expected to fail on PLATINUM, and succeeded). Fixes #125734
1 parent 0c50403 commit f64efbd

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialExtentAggregationNoLicenseIT.java

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88
package org.elasticsearch.xpack.esql.spatial;
99

10+
import org.elasticsearch.license.License;
11+
import org.elasticsearch.license.XPackLicenseState;
12+
import org.elasticsearch.license.internal.XPackLicenseStatus;
1013
import org.elasticsearch.plugins.Plugin;
11-
import org.elasticsearch.xpack.esql.action.EsqlPluginWithNonEnterpriseOrExpiredLicense;
14+
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
1215
import org.elasticsearch.xpack.spatial.SpatialPlugin;
1316

1417
import java.util.Collection;
@@ -18,11 +21,45 @@ public class SpatialExtentAggregationNoLicenseIT extends SpatialExtentAggregatio
1821

1922
@Override
2023
protected Collection<Class<? extends Plugin>> nodePlugins() {
21-
return List.of(SpatialPlugin.class, EsqlPluginWithNonEnterpriseOrExpiredLicense.class);
24+
return List.of(TestSpatialPlugin.class, TestEsqlPlugin.class);
2225
}
2326

2427
@Override
2528
public void testStExtentAggregationWithShapes() {
2629
assertStExtentFailsWith("index_geo_shape");
2730
}
31+
32+
private static XPackLicenseState getLicenseState() {
33+
License.OperationMode operationMode;
34+
boolean active;
35+
if (randomBoolean()) {
36+
operationMode = randomFrom(
37+
License.OperationMode.GOLD,
38+
License.OperationMode.BASIC,
39+
License.OperationMode.MISSING,
40+
License.OperationMode.STANDARD
41+
);
42+
active = true;
43+
} else {
44+
operationMode = randomFrom(License.OperationMode.PLATINUM, License.OperationMode.ENTERPRISE, License.OperationMode.TRIAL);
45+
active = false; // expired
46+
}
47+
48+
return new XPackLicenseState(
49+
() -> System.currentTimeMillis(),
50+
new XPackLicenseStatus(operationMode, active, "Test license expired")
51+
);
52+
}
53+
54+
public static class TestEsqlPlugin extends EsqlPlugin {
55+
protected XPackLicenseState getLicenseState() {
56+
return SpatialExtentAggregationNoLicenseIT.getLicenseState();
57+
}
58+
}
59+
60+
public static class TestSpatialPlugin extends SpatialPlugin {
61+
protected XPackLicenseState getLicenseState() {
62+
return SpatialExtentAggregationNoLicenseIT.getLicenseState();
63+
}
64+
}
2865
}

0 commit comments

Comments
 (0)