fix false test failure

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1101572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2011-05-10 18:02:06 +00:00
parent a7418eb206
commit 673cef5639
1 changed files with 12 additions and 8 deletions

View File

@ -18,7 +18,6 @@ package org.apache.lucene.index;
*/
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Reader;
@ -1130,10 +1129,12 @@ public class TestIndexWriter extends LuceneTestCase {
while(true) {
MergePolicy.OneMerge merge = writer.getNextMerge();
if (merge == null)
if (merge == null) {
break;
for(int i=0;i<merge.segments.size();i++)
assert merge.segments.info(i).docCount < 20;
}
for(int i=0;i<merge.segments.size();i++) {
assert merge.segments.get(i).docCount < 20;
}
writer.merge(merge);
}
}
@ -2141,6 +2142,7 @@ public class TestIndexWriter extends LuceneTestCase {
while(true) {
if (w != null) {
w.close();
w = null;
}
IndexWriterConfig conf = newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2);
@ -2186,11 +2188,13 @@ public class TestIndexWriter extends LuceneTestCase {
if (!failed) {
// clear interrupt state:
Thread.interrupted();
if (w != null) {
try {
w.rollback();
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
try {
_TestUtil.checkIndex(dir);