diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java index f468a6da31a..6254b309dbf 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java @@ -1104,6 +1104,14 @@ public class TestIndexWriterReader extends LuceneTestCase { public void testTooManySegments() throws Exception { Directory dir = newDirectory(); IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())); + MergePolicy mp = iwc.getMergePolicy(); + + // If we get TieredMP and it's maxMergedSegmentMB is 0 + // then this test falsely fails: + if (mp instanceof TieredMergePolicy) { + TieredMergePolicy tmp = (TieredMergePolicy) mp; + tmp.setMaxMergedSegmentMB(Math.max(.01, tmp.getMaxMergedSegmentMB())); + } IndexWriter w = new IndexWriter(dir, iwc); // Create 500 segments: for(int i=0;i<500;i++) {