Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,11 +21,45 @@ public class SpatialExtentAggregationNoLicenseIT extends SpatialExtentAggregatio

@Override
protected Collection<Class<? extends Plugin>> 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();
}
}
}