Skip to content

Commit e3672aa

Browse files
authored
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 427bc7f commit e3672aa

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
@@ -395,6 +395,9 @@ public void testQueryRandomGeoCollection() throws Exception {
395395
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
396396
SearchResponse result = client().prepareSearch("test").setQuery(geoShapeQueryBuilder).get();
397397
assertSearchResponse(result);
398+
assumeTrue("Skipping the check for the polygon with a degenerated dimension until "
399+
+" https://issues.apache.org/jira/browse/LUCENE-8634 is fixed",
400+
randomPoly.maxLat - randomPoly.minLat > 8.4e-8 && randomPoly.maxLon - randomPoly.minLon > 8.4e-8);
398401
assertHitCount(result, 1);
399402
}
400403

@@ -423,7 +426,8 @@ public void testRandomGeoCollectionQuery() throws Exception {
423426
}
424427
gcb.shape(new PolygonBuilder(cb));
425428

426-
logger.info("Created Random GeometryCollection containing {} shapes", gcb.numShapes());
429+
logger.info("Created Random GeometryCollection containing {} shapes using {} tree", gcb.numShapes(),
430+
usePrefixTrees ? "default" : "quadtree");
427431

428432
if (usePrefixTrees == false) {
429433
client().admin().indices().prepareCreate("test").addMapping("type", "location", "type=geo_shape")
@@ -444,7 +448,11 @@ public void testRandomGeoCollectionQuery() throws Exception {
444448
geoShapeQueryBuilder.relation(ShapeRelation.INTERSECTS);
445449
SearchResponse result = client().prepareSearch("test").setQuery(geoShapeQueryBuilder).get();
446450
assertSearchResponse(result);
447-
assertTrue(result.getHits().getTotalHits().value > 0);
451+
assumeTrue("Skipping the check for the polygon with a degenerated dimension until "
452+
+" https://issues.apache.org/jira/browse/LUCENE-8634 is fixed",
453+
randomPoly.maxLat - randomPoly.minLat > 8.4e-8 && randomPoly.maxLon - randomPoly.minLon > 8.4e-8);
454+
assertTrue("query: " + geoShapeQueryBuilder.toString() + " doc: " + Strings.toString(docSource),
455+
result.getHits().getTotalHits().value > 0);
448456
}
449457

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

0 commit comments

Comments
 (0)