Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 0 additions & 6 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/118914
- class: org.elasticsearch.xpack.security.authc.ldap.ActiveDirectoryRunAsIT
issue: https://github.com/elastic/elasticsearch/issues/115727
- class: org.elasticsearch.index.mapper.AbstractShapeGeometryFieldMapperTests
method: testCartesianBoundsBlockLoader
issue: https://github.com/elastic/elasticsearch/issues/119201
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=transform/transforms_start_stop/Test start/stop/start transform}
issue: https://github.com/elastic/elasticsearch/issues/119508
Expand Down Expand Up @@ -318,9 +315,6 @@ tests:
- class: org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests
method: testSnapshotRecovery {p0=false p1=true}
issue: https://github.com/elastic/elasticsearch/issues/122551
- class: org.elasticsearch.index.mapper.ShapeGeometryFieldMapperTests
method: testCartesianBoundsBlockLoader
issue: https://github.com/elastic/elasticsearch/issues/122661
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_408}
issue: https://github.com/elastic/elasticsearch/issues/122681
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.geo.GeoEncodingUtils;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.LeafReader;
import org.apache.lucene.store.Directory;
import org.apache.lucene.tests.index.RandomIndexWriter;
import org.elasticsearch.common.geo.GeometryNormalizer;
import org.elasticsearch.core.Strings;
import org.elasticsearch.geo.GeometryTestUtils;
Expand All @@ -39,14 +40,14 @@
import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
import static org.elasticsearch.common.geo.Orientation.RIGHT;

public class ShapeGeometryFieldMapperTests extends ESTestCase {
public class AbstractShapeGeometryFieldMapperTests extends ESTestCase {
public void testCartesianBoundsBlockLoader() throws IOException {
testBoundsBlockLoader(
CoordinateEncoder.CARTESIAN,
() -> ShapeTestUtils.randomGeometryWithoutCircle(0, false),
CartesianShapeIndexer::new,
SpatialEnvelopeVisitor::visitCartesian,
ShapeGeometryFieldMapperTests::makeCartesianRectangle
AbstractShapeGeometryFieldMapperTests::makeCartesianRectangle
);
}

Expand All @@ -58,7 +59,7 @@ public void ignoreTestGeoBoundsBlockLoader() throws IOException {
() -> normalize(GeometryTestUtils.randomGeometryWithoutCircle(0, false)),
field -> new GeoShapeIndexer(RIGHT, field),
g -> SpatialEnvelopeVisitor.visitGeo(g, SpatialEnvelopeVisitor.WrapLongitude.WRAP),
ShapeGeometryFieldMapperTests::makeGeoRectangle
AbstractShapeGeometryFieldMapperTests::makeGeoRectangle
);
}

Expand All @@ -72,7 +73,7 @@ public void ignoreTestRectangleCrossingDateline() throws IOException {
geometries,
field -> new GeoShapeIndexer(RIGHT, field),
g -> SpatialEnvelopeVisitor.visitGeo(g, SpatialEnvelopeVisitor.WrapLongitude.WRAP),
ShapeGeometryFieldMapperTests::makeGeoRectangle
AbstractShapeGeometryFieldMapperTests::makeGeoRectangle
);
}

Expand Down Expand Up @@ -100,7 +101,9 @@ private static void testBoundsBlockLoaderAux(
) throws IOException {
var loader = new AbstractShapeGeometryFieldMapper.AbstractShapeGeometryFieldType.BoundsBlockLoader("field");
try (Directory directory = newDirectory()) {
try (var iw = new RandomIndexWriter(random(), directory)) {
// Since we also test that the documents are loaded in the correct order, we need to write them in order, so we can't use
// RandomIndexWriter here.
try (var iw = new IndexWriter(directory, new IndexWriterConfig(null /* analyzer */))) {
for (Geometry geometry : geometries) {
var shape = new BinaryShapeDocValuesField("field", encoder);
shape.add(indexerFactory.apply("field").indexShape(geometry), geometry);
Expand Down