LUCENE-8442: Avoid merge in testPendingDeleteDVGeneration

If a merge is triggered, it might reclaim the randomFile which we picked
up but haven't opened yet, the test will fail with NoSuchFileException.
This commit disables merges to avoid such scenarios.
This commit is contained in:
Nhat Nguyen 2018-08-07 08:39:46 -04:00
parent 208d59b5e3
commit 3898653195
1 changed files with 2 additions and 0 deletions

View File

@ -2664,6 +2664,7 @@ public class TestIndexWriter extends LuceneTestCase {
Closeable closeable = () -> IOUtils.close(toClose)) {
IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()))
.setUseCompoundFile(false)
.setMergePolicy(NoMergePolicy.INSTANCE) // avoid merging away the randomFile
.setMaxBufferedDocs(2)
.setRAMBufferSizeMB(-1);
IndexWriter w = new IndexWriter(dir, iwc);
@ -2702,6 +2703,7 @@ public class TestIndexWriter extends LuceneTestCase {
w.rollback();
iwc = new IndexWriterConfig(new MockAnalyzer(random()))
.setUseCompoundFile(false)
.setMergePolicy(NoMergePolicy.INSTANCE)
.setMaxBufferedDocs(2)
.setRAMBufferSizeMB(-1);
w = new IndexWriter(dir, iwc);