mirror of https://github.com/apache/lucene.git
fix false random test failure (take 2)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1040447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ff47493dbd
commit
14305d9e3c
|
@ -115,10 +115,6 @@ public class BaseTestRangeFilter extends LuceneTestCase {
|
|||
|
||||
private static IndexReader build(Random random, TestIndex index) throws IOException {
|
||||
/* build an index */
|
||||
RandomIndexWriter writer = new RandomIndexWriter(random, index.index,
|
||||
newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||
.setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
|
||||
_TestUtil.reduceOpenFiles(writer.w);
|
||||
|
||||
Document doc = new Document();
|
||||
Field idField = newField(random, "id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
|
||||
|
@ -128,10 +124,15 @@ public class BaseTestRangeFilter extends LuceneTestCase {
|
|||
doc.add(randField);
|
||||
doc.add(bodyField);
|
||||
|
||||
RandomIndexWriter writer = new RandomIndexWriter(random, index.index,
|
||||
newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
|
||||
.setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
|
||||
while(true) {
|
||||
|
||||
int minCount = 0;
|
||||
int maxCount = 0;
|
||||
|
||||
while(true) {
|
||||
_TestUtil.reduceOpenFiles(writer.w);
|
||||
|
||||
for (int d = minId; d <= maxId; d++) {
|
||||
idField.setValue(pad(d));
|
||||
|
@ -160,17 +161,16 @@ public class BaseTestRangeFilter extends LuceneTestCase {
|
|||
// max, so, we loop until we satisfy that. it should be
|
||||
// exceedingly rare (Yonik calculates 1 in ~429,000)
|
||||
// times) that this loop requires more than one try:
|
||||
break;
|
||||
}
|
||||
|
||||
// try again
|
||||
}
|
||||
|
||||
IndexReader ir = writer.getReader();
|
||||
writer.close();
|
||||
return ir;
|
||||
}
|
||||
|
||||
// try again
|
||||
writer.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPad() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue