mirror of https://github.com/apache/lucene.git
Prevent TestStressIndexing from taking minutes for normal non-NIGHTLY runs (#11953)
This test intentionally does a ton of filesystem operations: currently about 20% of the time you can get really unlucky and get virus checker simulated, against a real filesystem, which makes things really slow. Instead use a ByteBuffersDirectory for local runs so that it doesn't take minutes. The test can still be pretty slow even with this implementation, so tone down the runtime so that it takes ~ 1.5s locally.
This commit is contained in:
parent
3f6410b738
commit
62f2b42502
|
@ -19,6 +19,7 @@ package org.apache.lucene.index;
|
|||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
|
||||
import org.apache.lucene.store.ByteBuffersDirectory;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.tests.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.tests.store.MockDirectoryWrapper;
|
||||
|
@ -28,7 +29,7 @@ import org.apache.lucene.tests.util.LuceneTestCase;
|
|||
public class TestStressIndexing extends LuceneTestCase {
|
||||
private abstract static class TimedThread extends Thread {
|
||||
volatile boolean failed;
|
||||
private static int RUN_ITERATIONS = atLeast(100);
|
||||
private static int RUN_ITERATIONS = TEST_NIGHTLY ? atLeast(100) : atLeast(20);
|
||||
private TimedThread[] allThreads;
|
||||
|
||||
public abstract void doWork() throws Throwable;
|
||||
|
@ -156,7 +157,12 @@ public class TestStressIndexing extends LuceneTestCase {
|
|||
|
||||
/* */
|
||||
public void testStressIndexAndSearching() throws Exception {
|
||||
Directory directory = newMaybeVirusCheckingDirectory();
|
||||
final Directory directory;
|
||||
if (TEST_NIGHTLY) {
|
||||
directory = newMaybeVirusCheckingDirectory();
|
||||
} else {
|
||||
directory = new MockDirectoryWrapper(random(), new ByteBuffersDirectory());
|
||||
}
|
||||
if (directory instanceof MockDirectoryWrapper) {
|
||||
((MockDirectoryWrapper) directory).setAssertNoUnrefencedFilesOnClose(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue