This commit is contained in:
Adrien Grand 2023-11-13 10:23:19 +01:00
parent c081cfa0ba
commit 1930425ffa
1 changed files with 7 additions and 4 deletions

View File

@ -2372,10 +2372,13 @@ public class TestIndexWriter extends LuceneTestCase {
public void testHasUncommittedChanges() throws IOException {
Directory dir = newDirectory();
IndexWriter writer = new IndexWriter(dir,
newIndexWriterConfig(new MockAnalyzer(random()))
// Use a serial merge scheduler to avoid race conditions when checking for hasPendingMerges()
.setMergeScheduler(new SerialMergeScheduler()));
IndexWriter writer =
new IndexWriter(
dir,
newIndexWriterConfig(new MockAnalyzer(random()))
// Use a serial merge scheduler to avoid race conditions when checking for
// hasPendingMerges()
.setMergeScheduler(new SerialMergeScheduler()));
assertTrue(
writer.hasUncommittedChanges()); // this will be true because a commit will create an empty
// index