You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2019/01/17 09:11:29 UTC

[lucene-solr] branch branch_8x updated: LUCENE-8643: TestLatLonLineShapeQueries.testRandomBig fails with suite timeout (simple text codec used, decreased iteration counts).

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 727d395  LUCENE-8643: TestLatLonLineShapeQueries.testRandomBig fails with suite timeout (simple text codec used, decreased iteration counts).
727d395 is described below

commit 727d395e58840e7d296acccc035e0a591d952c2c
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Thu Jan 17 10:09:44 2019 +0100

    LUCENE-8643: TestLatLonLineShapeQueries.testRandomBig fails with suite
    timeout (simple text codec used, decreased iteration counts).
---
 .../lucene/document/BaseLatLonShapeTestCase.java   | 30 ++++++++++++++++------
 .../document/TestLatLonLineShapeQueries.java       |  1 +
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/BaseLatLonShapeTestCase.java b/lucene/sandbox/src/test/org/apache/lucene/document/BaseLatLonShapeTestCase.java
index da8d567..f26c79a 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/document/BaseLatLonShapeTestCase.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/document/BaseLatLonShapeTestCase.java
@@ -50,7 +50,7 @@ import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 
 import static com.carrotsearch.randomizedtesting.RandomizedTest.randomBoolean;
-import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt;
+import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween;
 import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;
 import static org.apache.lucene.geo.GeoEncodingUtils.decodeLongitude;
 import static org.apache.lucene.geo.GeoEncodingUtils.encodeLatitude;
@@ -157,7 +157,7 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
 
   // A particularly tricky adversary for BKD tree:
   public void testSameShapeManyTimes() throws Exception {
-    int numShapes = atLeast(1000);
+    int numShapes = atLeast(500);
 
     // Every doc has 2 points:
     Object theShape = nextShape();
@@ -173,13 +173,15 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
     doTestRandom(10);
   }
 
+  @Slow
   public void testRandomMedium() throws Exception {
-    doTestRandom(10000);
+    doTestRandom(1000);
   }
 
+  @Slow
   @Nightly
   public void testRandomBig() throws Exception {
-    doTestRandom(50000);
+    doTestRandom(20000);
   }
 
   protected void doTestRandom(int count) throws Exception {
@@ -192,7 +194,7 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
 
     Object[] shapes = new Object[numShapes];
     for (int id = 0; id < numShapes; ++id) {
-      int x = randomInt(20);
+      int x = randomIntBetween(0, 20);
       if (x == 17) {
         shapes[id] = null;
         if (VERBOSE) {
@@ -266,7 +268,7 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
   protected void verifyRandomBBoxQueries(IndexReader reader, Object... shapes) throws Exception {
     IndexSearcher s = newSearcher(reader);
 
-    final int iters = atLeast(75);
+    final int iters = scaledIterationCount(shapes.length);
 
     Bits liveDocs = MultiBits.getLiveDocs(s.getIndexReader());
     int maxDoc = s.getIndexReader().maxDoc();
@@ -361,11 +363,23 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
     }
   }
 
+  private int scaledIterationCount(int shapes) {
+    if (shapes < 500) {
+      return atLeast(50);
+    } else if (shapes < 5000) {
+      return atLeast(25);
+    } else if (shapes < 25000) {
+      return atLeast(5);
+    } else {
+      return atLeast(2);
+    }
+  }
+
   /** test random generated lines */
   protected void verifyRandomLineQueries(IndexReader reader, Object... shapes) throws Exception {
     IndexSearcher s = newSearcher(reader);
 
-    final int iters = atLeast(75);
+    final int iters = scaledIterationCount(shapes.length);
 
     Bits liveDocs = MultiBits.getLiveDocs(s.getIndexReader());
     int maxDoc = s.getIndexReader().maxDoc();
@@ -452,7 +466,7 @@ public abstract class BaseLatLonShapeTestCase extends LuceneTestCase {
   protected void verifyRandomPolygonQueries(IndexReader reader, Object... shapes) throws Exception {
     IndexSearcher s = newSearcher(reader);
 
-    final int iters = atLeast(75);
+    final int iters = scaledIterationCount(shapes.length);
 
     Bits liveDocs = MultiBits.getLiveDocs(s.getIndexReader());
     int maxDoc = s.getIndexReader().maxDoc();
diff --git a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonLineShapeQueries.java b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonLineShapeQueries.java
index ab409f2..87a2c94 100644
--- a/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonLineShapeQueries.java
+++ b/lucene/sandbox/src/test/org/apache/lucene/document/TestLatLonLineShapeQueries.java
@@ -29,6 +29,7 @@ import org.apache.lucene.geo.Rectangle2D;
 import org.apache.lucene.index.PointValues.Relation;
 
 /** random bounding box and polygon query tests for random generated {@link Line} types */
+@SuppressWarnings("SimpleText")
 public class TestLatLonLineShapeQueries extends BaseLatLonShapeTestCase {
 
   protected final LineValidator VALIDATOR = new LineValidator();