diff --git a/muted-tests.yml b/muted-tests.yml index 8d596bd8e65fe..f1e5ff6248f5e 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -261,9 +261,6 @@ tests: - class: org.elasticsearch.index.shard.StoreRecoveryTests method: testAddIndices issue: https://github.com/elastic/elasticsearch/issues/124104 -- class: org.elasticsearch.xpack.esql.spatial.SpatialExtentAggregationNoLicenseIT - method: testStExtentAggregationWithShapes - issue: https://github.com/elastic/elasticsearch/issues/125734 - class: org.elasticsearch.smoketest.MlWithSecurityIT method: test {yaml=ml/trained_model_cat_apis/Test cat trained models} issue: https://github.com/elastic/elasticsearch/issues/125750 diff --git a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialExtentAggregationNoLicenseIT.java b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialExtentAggregationNoLicenseIT.java index f4378de627dd9..6d3a28b9060ee 100644 --- a/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialExtentAggregationNoLicenseIT.java +++ b/x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/spatial/SpatialExtentAggregationNoLicenseIT.java @@ -7,8 +7,11 @@ package org.elasticsearch.xpack.esql.spatial; +import org.elasticsearch.license.License; +import org.elasticsearch.license.XPackLicenseState; +import org.elasticsearch.license.internal.XPackLicenseStatus; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.esql.action.EsqlPluginWithNonEnterpriseOrExpiredLicense; +import org.elasticsearch.xpack.esql.plugin.EsqlPlugin; import org.elasticsearch.xpack.spatial.SpatialPlugin; import java.util.Collection; @@ -18,11 +21,45 @@ public class SpatialExtentAggregationNoLicenseIT extends SpatialExtentAggregatio @Override protected Collection> nodePlugins() { - return List.of(SpatialPlugin.class, EsqlPluginWithNonEnterpriseOrExpiredLicense.class); + return List.of(TestSpatialPlugin.class, TestEsqlPlugin.class); } @Override public void testStExtentAggregationWithShapes() { assertStExtentFailsWith("index_geo_shape"); } + + private static XPackLicenseState getLicenseState() { + License.OperationMode operationMode; + boolean active; + if (randomBoolean()) { + operationMode = randomFrom( + License.OperationMode.GOLD, + License.OperationMode.BASIC, + License.OperationMode.MISSING, + License.OperationMode.STANDARD + ); + active = true; + } else { + operationMode = randomFrom(License.OperationMode.PLATINUM, License.OperationMode.ENTERPRISE, License.OperationMode.TRIAL); + active = false; // expired + } + + return new XPackLicenseState( + () -> System.currentTimeMillis(), + new XPackLicenseStatus(operationMode, active, "Test license expired") + ); + } + + public static class TestEsqlPlugin extends EsqlPlugin { + protected XPackLicenseState getLicenseState() { + return SpatialExtentAggregationNoLicenseIT.getLicenseState(); + } + } + + public static class TestSpatialPlugin extends SpatialPlugin { + protected XPackLicenseState getLicenseState() { + return SpatialExtentAggregationNoLicenseIT.getLicenseState(); + } + } }