Skip to content

Apache Lucene open-source search software

[TEST] Ensure IW doesn't autoflush since test relies on it producing a single segment

Simon Willnauerdd39128eaeea
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPendingSoftDeletes.java b/lucene/core/src/test/org/apache/lucene/index/TestPendingSoftDeletes.java
index eac438826d1..9878b16f4d9 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestPendingSoftDeletes.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestPendingSoftDeletes.java
@@ -152,7 +152,10 @@ public class TestPendingSoftDeletes extends TestPendingDeletes {
public void testUpdateAppliedOnlyOnce() throws IOException {
Directory dir = newDirectory();
- IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig().setSoftDeletesField("_soft_deletes"));
+ IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig()
+ .setSoftDeletesField("_soft_deletes")
+ .setMaxBufferedDocs(3) // make sure we write one segment
+ .setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH));
Document doc = new Document();
doc.add(new StringField("id", "1", Field.Store.YES));
writer.softUpdateDocument(new Term("id", "1"), doc,