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)
|
||||
);
|
||||
|
||||
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++) {
|
||||
idField.setStringValue(Integer.toString(iter*201+j));
|
||||
|
|
|
@ -70,8 +70,8 @@ public class TestExitableDirectoryReader extends LuceneTestCase {
|
|||
@Override
|
||||
public BytesRef next() throws IOException {
|
||||
try {
|
||||
// Sleep for 1s before each .next() call.
|
||||
Thread.sleep(1000);
|
||||
// Sleep for 100ms before each .next() call.
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
return in.next();
|
||||
|
@ -118,10 +118,10 @@ public class TestExitableDirectoryReader extends LuceneTestCase {
|
|||
|
||||
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.
|
||||
directoryReader = DirectoryReader.open(directory);
|
||||
exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, new QueryTimeoutImpl(10000));
|
||||
exitableDirectoryReader = new ExitableDirectoryReader(directoryReader, new QueryTimeoutImpl(1000));
|
||||
reader = new TestReader(exitableDirectoryReader);
|
||||
searcher = new IndexSearcher(reader);
|
||||
searcher.search(query, 10);
|
||||
|
|
|
@ -941,6 +941,12 @@ public class TestIndexWriter extends LuceneTestCase {
|
|||
// When interrupt arrives in w.close(), this can
|
||||
// lead to double-write of files:
|
||||
dir.setPreventDoubleWrite(false);
|
||||
|
||||
// open/close slowly sometimes
|
||||
dir.setUseSlowOpenClosers(true);
|
||||
|
||||
// throttle a little
|
||||
dir.setThrottling(MockDirectoryWrapper.Throttling.SOMETIMES);
|
||||
|
||||
IndexWriter w = null;
|
||||
while(!finish) {
|
||||
|
|
|
@ -30,6 +30,8 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.apache.lucene.index.RandomIndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.MockDirectoryWrapper;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
|
||||
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 {
|
||||
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));
|
||||
writer.addDocument(doc);
|
||||
|
||||
|
|
|
@ -78,8 +78,7 @@ public class TestTopDocsMerge extends LuceneTestCase {
|
|||
IndexReader reader = null;
|
||||
Directory dir = null;
|
||||
|
||||
final int numDocs = atLeast(1000);
|
||||
//final int numDocs = atLeast(50);
|
||||
final int numDocs = TEST_NIGHTLY ? atLeast(1000) : atLeast(100);
|
||||
|
||||
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, false));
|
||||
|
||||
for(int iter=0;iter<1000*RANDOM_MULTIPLIER;iter++) {
|
||||
int numIters = atLeast(300);
|
||||
for(int iter=0;iter<numIters;iter++) {
|
||||
|
||||
// TODO: custom FieldComp...
|
||||
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 trackDiskUsage = false;
|
||||
boolean wrapLocking = true;
|
||||
boolean useSlowOpenClosers = true;
|
||||
boolean useSlowOpenClosers = LuceneTestCase.TEST_NIGHTLY;
|
||||
boolean enableVirusScanner = true;
|
||||
boolean allowRandomFileNotFoundException = true;
|
||||
boolean allowReadingFilesStillOpenForWrite = false;
|
||||
|
@ -85,7 +85,7 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper {
|
|||
Map<String,Exception> openLocks = Collections.synchronizedMap(new HashMap<String,Exception>());
|
||||
volatile boolean crashed;
|
||||
private ThrottledIndexOutput throttledOutput;
|
||||
private Throttling throttling = Throttling.SOMETIMES;
|
||||
private Throttling throttling = LuceneTestCase.TEST_NIGHTLY ? Throttling.SOMETIMES : Throttling.NEVER;
|
||||
|
||||
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>
|
||||
* You can disable this if you dont need it
|
||||
* You can enable this if you need it.
|
||||
*/
|
||||
public void setUseSlowOpenClosers(boolean v) {
|
||||
useSlowOpenClosers = v;
|
||||
|
|
|
@ -1330,7 +1330,7 @@ public abstract class LuceneTestCase extends Assert {
|
|||
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);
|
||||
if (LuceneTestCase.VERBOSE) {
|
||||
System.out.println("LuceneTestCase: will rate limit output IndexOutput to " + maxMBPerSec + " MB/sec");
|
||||
|
|
Loading…
Reference in New Issue