From 85f5d3bb0bf84fed46ca4c093c1aa084e4a43873 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Tue, 31 Oct 2023 09:47:19 +0100 Subject: [PATCH] Fix test after #12549. --- .../test/org/apache/lucene/index/TestIndexWriter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java index 5916ec33f0d..1990ce93deb 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java @@ -2404,11 +2404,12 @@ public class TestIndexWriter extends LuceneTestCase { writer.deleteDocuments(new Term("id", "xyz")); assertTrue(writer.hasUncommittedChanges()); - // Must commit, waitForMerges, commit again, to be - // certain that hasUncommittedChanges returns false: - writer.commit(); - writer.waitForMerges(); - writer.commit(); + // Must commit and wait for merges as long as the commit triggers merges to be certain that + // hasUncommittedChanges returns false + do { + writer.waitForMerges(); + writer.commit(); + } while (writer.hasPendingMerges()); assertFalse(writer.hasUncommittedChanges()); writer.close();