Skip to content

Commit 961162a

Browse files
committed
Tests: disable testRandomGeoCollectionQuery on tiny polygons (#37579)
Due to https://issues.apache.org/jira/browse/LUCENE-8634 this test may fail if a really tiny polygon is generated. This commit checks for tiny polygons and skips the final check, which is expected to fail until the lucene bug is fixed and new version of lucene is released.
1 parent 6551e5d commit 961162a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/src/test/java/org/elasticsearch/search/geo/GeoShapeQueryTests.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ public void testShapeFetchingPath() throws Exception {
328328
assertHitCount(result, 1);
329329
}
330330

331-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37356")
332331
public void testQueryRandomGeoCollection() throws Exception {
333332
// Create a random geometry collection.
334333
GeometryCollectionBuilder gcb = RandomShapeGenerator.createGeometryCollection(random());
@@ -358,6 +357,9 @@ public void testQueryRandomGeoCollection() throws Exception {
358357
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
359358
SearchResponse result = client().prepareSearch("test").setTypes("type").setQuery(geoShapeQueryBuilder).get();
360359
assertSearchResponse(result);
360+
assumeTrue("Skipping the check for the polygon with a degenerated dimension until "
361+
+" https://issues.apache.org/jira/browse/LUCENE-8634 is fixed",
362+
randomPoly.maxLat - randomPoly.minLat > 8.4e-8 && randomPoly.maxLon - randomPoly.minLon > 8.4e-8);
361363
assertHitCount(result, 1);
362364
}
363365

@@ -386,7 +388,8 @@ public void testRandomGeoCollectionQuery() throws Exception {
386388
}
387389
gcb.shape(new PolygonBuilder(cb));
388390

389-
logger.info("Created Random GeometryCollection containing {} shapes", gcb.numShapes());
391+
logger.info("Created Random GeometryCollection containing {} shapes using {} tree", gcb.numShapes(),
392+
usePrefixTrees ? "default" : "quadtree");
390393

391394
if (usePrefixTrees == false) {
392395
client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape")
@@ -407,7 +410,11 @@ public void testRandomGeoCollectionQuery() throws Exception {
407410
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
408411
SearchResponse result = client().prepareSearch("test").setTypes("type").setQuery(geoShapeQueryBuilder).get();
409412
assertSearchResponse(result);
410-
assertTrue(result.getHits().getTotalHits() > 0);
413+
assumeTrue("Skipping the check for the polygon with a degenerated dimension until "
414+
+" https://issues.apache.org/jira/browse/LUCENE-8634 is fixed",
415+
randomPoly.maxLat - randomPoly.minLat > 8.4e-8 && randomPoly.maxLon - randomPoly.minLon > 8.4e-8);
416+
assertTrue("query: " + geoShapeQueryBuilder.toString() + " doc: " + Strings.toString(docSource),
417+
result.getHits().getTotalHits() > 0);
411418
}
412419

413420
/** tests querying a random geometry collection with a point */

0 commit comments

Comments
 (0)