Skip to content

Commit d3bc751

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 3500dea commit d3bc751

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ public void testQueryRandomGeoCollection() throws Exception {
357357
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
358358
SearchResponse result = client().prepareSearch("test").setTypes("type").setQuery(geoShapeQueryBuilder).get();
359359
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);
360363
assertHitCount(result, 1);
361364
}
362365

@@ -385,7 +388,8 @@ public void testRandomGeoCollectionQuery() throws Exception {
385388
}
386389
gcb.shape(new PolygonBuilder(cb));
387390

388-
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");
389393

390394
if (usePrefixTrees == false) {
391395
client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape")
@@ -406,7 +410,11 @@ public void testRandomGeoCollectionQuery() throws Exception {
406410
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
407411
SearchResponse result = client().prepareSearch("test").setTypes("type").setQuery(geoShapeQueryBuilder).get();
408412
assertSearchResponse(result);
409-
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);
410418
}
411419

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

0 commit comments

Comments
 (0)