LUCENE-3606: fix test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1211983 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-12-08 17:04:06 +00:00
parent 01b2b6e437
commit ef6f10a14c
1 changed files with 13 additions and 7 deletions

View File

@ -452,7 +452,6 @@ public class TestAddIndexes extends LuceneTestCase {
aux.close(); aux.close();
} }
/* nocommit: re-enable
// case 5: tail segments, invariants not hold // case 5: tail segments, invariants not hold
public void testMoreMerges() throws IOException { public void testMoreMerges() throws IOException {
// main directory // main directory
@ -461,7 +460,7 @@ public class TestAddIndexes extends LuceneTestCase {
Directory aux = newDirectory(); Directory aux = newDirectory();
Directory aux2 = newDirectory(); Directory aux2 = newDirectory();
setUpDirs(dir, aux); setUpDirs(dir, aux, true);
IndexWriter writer = newWriter( IndexWriter writer = newWriter(
aux2, aux2,
@ -475,17 +474,25 @@ public class TestAddIndexes extends LuceneTestCase {
assertEquals(3, writer.getSegmentCount()); assertEquals(3, writer.getSegmentCount());
writer.close(); writer.close();
IndexReader reader = IndexReader.open(aux); IndexWriterConfig dontMergeConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
writer = new IndexWriter(aux, dontMergeConfig);
for (int i = 0; i < 27; i++) { for (int i = 0; i < 27; i++) {
reader.deleteDocument(i); writer.deleteDocuments(new Term("id", "" + i));
} }
writer.close();
IndexReader reader = IndexReader.open(aux);
assertEquals(3, reader.numDocs()); assertEquals(3, reader.numDocs());
reader.close(); reader.close();
reader = IndexReader.open(aux2); dontMergeConfig = new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setMergePolicy(NoMergePolicy.COMPOUND_FILES);
writer = new IndexWriter(aux2, dontMergeConfig);
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
reader.deleteDocument(i); writer.deleteDocuments(new Term("id", "" + i));
} }
writer.close();
reader = IndexReader.open(aux2);
assertEquals(22, reader.numDocs()); assertEquals(22, reader.numDocs());
reader.close(); reader.close();
@ -505,7 +512,6 @@ public class TestAddIndexes extends LuceneTestCase {
aux.close(); aux.close();
aux2.close(); aux2.close();
} }
*/
private IndexWriter newWriter(Directory dir, IndexWriterConfig conf) private IndexWriter newWriter(Directory dir, IndexWriterConfig conf)
throws IOException { throws IOException {