Apache Lucene open-source search software
Fix more of isLoaded conditions. Just ignore NRT entirely since it may or may not return a buffered slice. (#15966)
Dawid Weiss294f5c470d32
diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.javaindex 6292c69931a..d78eb0c5ac7 100644--- a/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/store/BaseDirectoryTestCase.java@@ -1661,20 +1661,16 @@ public abstract class BaseDirectoryTestCase extends LuceneTestCase {// On Windows, we temporarily don't care until this is fixed: #14050} else if (mMapDir != null) {var wrappers = wrapperClasses(dir);- // Direct IO wraps MMap but does not support isLoaded.- // NRTCachingDirectory may return index inputs from cache.- if (wrappers.stream()- .noneMatch(- clz ->- clz.getName().contains("DirectIO")- || NRTCachingDirectory.class.isAssignableFrom(clz))) {+ // NRTCachingDirectory may return index inputs from cache and this+ // depends on segment size.+ if (wrappers.stream().anyMatch(NRTCachingDirectory.class::isAssignableFrom)) {+ // Ignore the check.+ } else if (wrappers.stream().anyMatch(clz -> clz.getName().contains("DirectIO"))) {+ // Direct IO wraps MMap but does not support isLoaded.+ } else {assertTrue(loaded.isPresent());assertTrue(loaded.get());- } else {- assertFalse(loaded.isPresent());}- } else {- assertFalse(loaded.isPresent());}}}