diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java index bee82cc4fd0..941767b2ac3 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java +++ b/lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java @@ -192,6 +192,9 @@ public class MockDirectoryWrapper extends BaseDirectoryWrapper { private boolean mustSync() { Directory delegate = in; while (delegate instanceof FilterDirectory) { + if (delegate instanceof NRTCachingDirectory) { + return true; + } delegate = ((FilterDirectory) delegate).getDelegate(); } return delegate instanceof NRTCachingDirectory;