mikemccand commented on a change in pull request #2342:
URL: https://github.com/apache/lucene-solr/pull/2342#discussion_r574877742



##########
File path: 
lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMergePolicy.java
##########
@@ -388,6 +388,69 @@ public void testMergeOnCommit() throws IOException {
     dir.close();
   }
 
+  private class TesIndexWriterEventListener implements 
IndexWriterEventListener {
+    private boolean beginMergeCalled = false;
+    private boolean endMergeCalled = false;
+
+    @Override
+    public void beginMergeOnFullFlush(MergePolicy.OneMerge merge) {
+      beginMergeCalled = true;
+    }
+
+    @Override
+    public void endMergeOnFullFlush(MergePolicy.OneMerge merge) {
+      endMergeCalled = true;
+    }
+
+    public boolean isEventsRecorded() {
+      return beginMergeCalled && endMergeCalled;
+    }
+  }
+
+  // Test basic semantics of merge on commit and events recording invocation
+  public void testMergeOnCommitWithEventListener() throws IOException {

Review comment:
       You might also edit `LuceneTestCase.newIndexWriterConfig` to randomly 
swap in a `MockIndexWriterEventListener` just to exercise this listener in any 
tests using that API, which is quite a few.  It could uncover times when we 
accidentally break something when this listener is invoked ...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to