Apache Lucene open-source search software
Fix test that fails on Windows if it gets a FSDirectory (it intentionally does not close IW/IR). The new cleanup code then complains about inability to delete the index dir
Uwe Schindler3f773d6699d3
diff --git a/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailOnFieldCacheInsanity.java b/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailOnFieldCacheInsanity.javaindex 354e145aab7..20d57a6d27c 100644--- a/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailOnFieldCacheInsanity.java+++ b/lucene/core/src/test/org/apache/lucene/util/junitcompat/TestFailOnFieldCacheInsanity.java@@ -24,6 +24,8 @@ import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.search.FieldCache;import org.apache.lucene.store.Directory;+import org.apache.lucene.store.MockDirectoryWrapper;+import org.apache.lucene.store.RAMDirectory;import org.junit.Assert;import org.junit.Test;import org.junit.runner.JUnitCore;@@ -41,8 +43,10 @@ public class TestFailOnFieldCacheInsanity extends WithNestedTests {private AtomicReader subR;private void makeIndex() throws Exception {- d = newDirectory();- RandomIndexWriter w = new RandomIndexWriter(random(), d);+ // we use RAMDirectory here, because we dont want to stay on open files on Windows:+ d = new MockDirectoryWrapper(random(), new RAMDirectory());+ @SuppressWarnings("resource") RandomIndexWriter w =+ new RandomIndexWriter(random(), d);Document doc = new Document();doc.add(newField("ints", "1", StringField.TYPE_NOT_STORED));w.addDocument(doc);