diff --git a/muted-tests.yml b/muted-tests.yml index db95b63648393..fe9702984adbe 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -130,9 +130,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 @@ -266,9 +263,6 @@ tests: - class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_488} issue: https://github.com/elastic/elasticsearch/issues/121611 -- 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 diff --git a/server/src/test/java/org/elasticsearch/index/mapper/ShapeGeometryFieldMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/AbstractShapeGeometryFieldMapperTests.java similarity index 93% rename from server/src/test/java/org/elasticsearch/index/mapper/ShapeGeometryFieldMapperTests.java rename to server/src/test/java/org/elasticsearch/index/mapper/AbstractShapeGeometryFieldMapperTests.java index 0322286277b25..73d76ad48c955 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/ShapeGeometryFieldMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/AbstractShapeGeometryFieldMapperTests.java @@ -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; @@ -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 ); } @@ -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 ); } @@ -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 ); } @@ -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);