Apache Lucene open-source search software
speed up extremely slow test methods (runtime 15-30s) (#471)
Robert Muir3772ff563a61
diff --git a/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java b/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.javaindex b2ebc21c174..45719f0eece 100644--- a/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java+++ b/lucene/codecs/src/test/org/apache/lucene/codecs/simpletext/TestSimpleTextTermVectorsFormat.java@@ -16,8 +16,10 @@*/package org.apache.lucene.codecs.simpletext;+import java.io.IOException;import org.apache.lucene.codecs.Codec;import org.apache.lucene.index.BaseTermVectorsFormatTestCase;+import org.apache.lucene.util.LuceneTestCase;public class TestSimpleTextTermVectorsFormat extends BaseTermVectorsFormatTestCase {@Override@@ -29,4 +31,18 @@ public class TestSimpleTextTermVectorsFormat extends BaseTermVectorsFormatTestCaprotected Codec getCodec() {return new SimpleTextCodec();}++ // TODO: can we speed up the underlying base test?+ @Override+ @LuceneTestCase.Nightly+ public void testMergeWithIndexSort() throws IOException {+ super.testMergeWithIndexSort();+ }++ // TODO: can we speed up the underlying base test?+ @Override+ @LuceneTestCase.Nightly+ public void testMergeWithoutIndexSort() throws IOException {+ super.testMergeWithoutIndexSort();+ }}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterThreadsToSegments.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterThreadsToSegments.javaindex 78c3f1b780a..81485d4547f 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterThreadsToSegments.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterThreadsToSegments.java@@ -303,6 +303,8 @@ public class TestIndexWriterThreadsToSegments extends LuceneTestCase {dir.close();}+ // TODO: can we make this test more efficient so it doesn't need to be nightly?+ @LuceneTestCase.Nightlypublic void testDocsStuckInRAMForever() throws Exception {Directory dir = newDirectory();IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java b/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.javaindex 3e911357f5d..ff915693105 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestSortOptimization.java@@ -708,7 +708,8 @@ public class TestSortOptimization extends LuceneTestCase {Directory dir = newDirectory();IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig());List<Long> seqNos = new ArrayList<>();- int iterations = 10000 + random().nextInt(10000);+ int limit = TEST_NIGHTLY ? 10000 : 1000;+ int iterations = limit + random().nextInt(limit);long seqNoGenerator = random().nextInt(1000);for (long i = 0; i < iterations; i++) {int copies = random().nextInt(100) <= 5 ? 1 : 1 + random().nextInt(5);