mirror of https://github.com/apache/lucene.git
more test tuning
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1642202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86a6c37b47
commit
cee3a963e7
|
@ -222,7 +222,8 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
|
||||||
setCommitOnClose(false)
|
setCommitOnClose(false)
|
||||||
);
|
);
|
||||||
|
|
||||||
for(int iter=0;iter<10;iter++) {
|
int numIters = TEST_NIGHTLY ? 10 : 3;
|
||||||
|
for(int iter=0;iter<numIters;iter++) {
|
||||||
|
|
||||||
for(int j=0;j<201;j++) {
|
for(int j=0;j<201;j++) {
|
||||||
idField.setStringValue(Integer.toString(iter*201+j));
|
idField.setStringValue(Integer.toString(iter*201+j));
|
||||||
|
|
|
@ -70,8 +70,8 @@ public class TestExitableDirectoryReader extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
public BytesRef next() throws IOException {
|
public BytesRef next() throws IOException {
|
||||||
try {
|
try {
|
||||||
// Sleep for 1s before each .next() call.
|
// Sleep for 100ms before each .next() call.
|
||||||
Thread.sleep(1000);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
return in.next();
|
return in.next();
|
||||||
|
@ -118,10 +118,10 @@ public class TestExitableDirectoryReader extends LuceneTestCase {
|
||||||
|
|
||||||
Query query = new PrefixQuery(new Term("default", "o"));
|
Query query = new PrefixQuery(new Term("default", "o"));
|
||||||
|
|
||||||
// Set a fairly high timeout value (10 seconds) and expect the query to complete in that time frame.
|
// Set a fairly high timeout value (1 second) and expect the query to complete in that time frame.
|
||||||
// Not checking the validity of the result, all we are bothered about in this test is the timing out.
|
// Not checking the validity of the result, all we are bothered about in this test is the timing out.
|
||||||
directoryReader = DirectoryReader.open(directory);
|
directoryReader = DirectoryReader.open(directory);
|
||||||
exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, new QueryTimeoutImpl(10000));
|
exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, new QueryTimeoutImpl(1000));
|
||||||
reader = new TestReader(exitableDirectoryReader);
|
reader = new TestReader(exitableDirectoryReader);
|
||||||
searcher = new IndexSearcher(reader);
|
searcher = new IndexSearcher(reader);
|
||||||
searcher.search(query, 10);
|
searcher.search(query, 10);
|
||||||
|
|
|
@ -941,6 +941,12 @@ public class TestIndexWriter extends LuceneTestCase {
|
||||||
// When interrupt arrives in w.close(), this can
|
// When interrupt arrives in w.close(), this can
|
||||||
// lead to double-write of files:
|
// lead to double-write of files:
|
||||||
dir.setPreventDoubleWrite(false);
|
dir.setPreventDoubleWrite(false);
|
||||||
|
|
||||||
|
// open/close slowly sometimes
|
||||||
|
dir.setUseSlowOpenClosers(true);
|
||||||
|
|
||||||
|
// throttle a little
|
||||||
|
dir.setThrottling(MockDirectoryWrapper.Throttling.SOMETIMES);
|
||||||
|
|
||||||
IndexWriter w = null;
|
IndexWriter w = null;
|
||||||
while(!finish) {
|
while(!finish) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.RandomIndexWriter;
|
import org.apache.lucene.index.RandomIndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
|
import org.apache.lucene.store.MockDirectoryWrapper;
|
||||||
|
import org.apache.lucene.store.RAMDirectory;
|
||||||
|
|
||||||
public class TestSloppyPhraseQuery extends LuceneTestCase {
|
public class TestSloppyPhraseQuery extends LuceneTestCase {
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ public class TestSloppyPhraseQuery extends LuceneTestCase {
|
||||||
private float checkPhraseQuery(Document doc, PhraseQuery query, int slop, int expectedNumResults) throws Exception {
|
private float checkPhraseQuery(Document doc, PhraseQuery query, int slop, int expectedNumResults) throws Exception {
|
||||||
query.setSlop(slop);
|
query.setSlop(slop);
|
||||||
|
|
||||||
Directory ramDir = newDirectory();
|
MockDirectoryWrapper ramDir = new MockDirectoryWrapper(random(), new RAMDirectory());
|
||||||
RandomIndexWriter writer = new RandomIndexWriter(random(), ramDir, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false));
|
RandomIndexWriter writer = new RandomIndexWriter(random(), ramDir, new MockAnalyzer(random(), MockTokenizer.WHITESPACE, false));
|
||||||
writer.addDocument(doc);
|
writer.addDocument(doc);
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,7 @@ public class TestTopDocsMerge extends LuceneTestCase {
|
||||||
IndexReader reader = null;
|
IndexReader reader = null;
|
||||||
Directory dir = null;
|
Directory dir = null;
|
||||||
|
|
||||||
final int numDocs = atLeast(1000);
|
final int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);
|
||||||
//final int numDocs = atLeast(50);
|
|
||||||
|
|
||||||
final String[] tokens = new String[] {"a", "b", "c", "d", "e"};
|
final String[] tokens = new String[] {"a", "b", "c", "d", "e"};
|
||||||
|
|
||||||
|
@ -168,7 +167,8 @@ public class TestTopDocsMerge extends LuceneTestCase {
|
||||||
sortFields.add(new SortField(null, SortField.Type.DOC, true));
|
sortFields.add(new SortField(null, SortField.Type.DOC, true));
|
||||||
sortFields.add(new SortField(null, SortField.Type.DOC, false));
|
sortFields.add(new SortField(null, SortField.Type.DOC, false));
|
||||||
|
|
||||||
for(int iter=0;iter<1000*RANDOM_MULTIPLIER;iter++) {
|
int numIters = atLeast(300);
|
||||||
|
for(int iter=0;iter<numIters;iter++) {
|
||||||
|
|
||||||
// TODO: custom FieldComp...
|
// TODO: custom FieldComp...
|
||||||
final Query query = new TermQuery(new Term("text", tokens[random().nextInt(tokens.length)]));
|
final Query query = new TermQuery(new Term("text", tokens[random().nextInt(tokens.length)]));
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
||||||
boolean preventDoubleWrite = true;
|
boolean preventDoubleWrite = true;
|
||||||
boolean trackDiskUsage = false;
|
boolean trackDiskUsage = false;
|
||||||
boolean wrapLocking = true;
|
boolean wrapLocking = true;
|
||||||
boolean useSlowOpenClosers = true;
|
boolean useSlowOpenClosers = LuceneTestCase.TEST_NIGHTLY;
|
||||||
boolean enableVirusScanner = true;
|
boolean enableVirusScanner = true;
|
||||||
boolean allowRandomFileNotFoundException = true;
|
boolean allowRandomFileNotFoundException = true;
|
||||||
boolean allowReadingFilesStillOpenForWrite = false;
|
boolean allowReadingFilesStillOpenForWrite = false;
|
||||||
|
@ -85,7 +85,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
||||||
Map<String,Exception> openLocks = Collections.synchronizedMap(new HashMap<String,Exception>());
|
Map<String,Exception> openLocks = Collections.synchronizedMap(new HashMap<String,Exception>());
|
||||||
volatile boolean crashed;
|
volatile boolean crashed;
|
||||||
private ThrottledIndexOutput throttledOutput;
|
private ThrottledIndexOutput throttledOutput;
|
||||||
private Throttling throttling = Throttling.SOMETIMES;
|
private Throttling throttling = LuceneTestCase.TEST_NIGHTLY ? Throttling.SOMETIMES : Throttling.NEVER;
|
||||||
|
|
||||||
final AtomicInteger inputCloneCount = new AtomicInteger();
|
final AtomicInteger inputCloneCount = new AtomicInteger();
|
||||||
|
|
||||||
|
@ -191,9 +191,9 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default, opening and closing has a rare small sleep to catch race conditions
|
* Add a rare small sleep to catch race conditions in open/close
|
||||||
* <p>
|
* <p>
|
||||||
* You can disable this if you dont need it
|
* You can enable this if you need it.
|
||||||
*/
|
*/
|
||||||
public void setUseSlowOpenClosers(boolean v) {
|
public void setUseSlowOpenClosers(boolean v) {
|
||||||
useSlowOpenClosers = v;
|
useSlowOpenClosers = v;
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ public abstract class LuceneTestCase extends Assert {
|
||||||
directory = new NRTCachingDirectory(directory, random.nextDouble(), random.nextDouble());
|
directory = new NRTCachingDirectory(directory, random.nextDouble(), random.nextDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rarely(random) && !bare) {
|
if (TEST_NIGHTLY && rarely(random) && !bare) {
|
||||||
final double maxMBPerSec = TestUtil.nextInt(random, 20, 40);
|
final double maxMBPerSec = TestUtil.nextInt(random, 20, 40);
|
||||||
if (LuceneTestCase.VERBOSE) {
|
if (LuceneTestCase.VERBOSE) {
|
||||||
System.out.println("LuceneTestCase: will rate limit output IndexOutput to " + maxMBPerSec + " MB/sec");
|
System.out.println("LuceneTestCase: will rate limit output IndexOutput to " + maxMBPerSec + " MB/sec");
|
||||||
|
|
Loading…
Reference in New Issue