Skip to content

Commit 3a542dc

Browse files
[9.0] Use PLATINUM as license level for spatial features (125802) (elastic#125803)
* Use PLATINUM as license level for spatial features * Unmute the test
1 parent 4d31c59 commit 3a542dc

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ tests:
261261
- class: org.elasticsearch.index.shard.StoreRecoveryTests
262262
method: testAddIndices
263263
issue: https://github.com/elastic/elasticsearch/issues/124104
264-
- class: org.elasticsearch.xpack.esql.spatial.SpatialExtentAggregationNoLicenseIT
265-
method: testStExtentAggregationWithShapes
266-
issue: https://github.com/elastic/elasticsearch/issues/125734
267264
- class: org.elasticsearch.smoketest.MlWithSecurityIT
268265
method: test {yaml=ml/trained_model_cat_apis/Test cat trained models}
269266
issue: https://github.com/elastic/elasticsearch/issues/125750

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)