From 0b256cc62950f2bbfdb9f42c12986d0933aa163c Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 5 May 2015 20:45:49 +0200 Subject: [PATCH] [TEST] also close wrapped readers --- .../elasticsearch/common/lucene/IndexCacheableQueryTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/common/lucene/IndexCacheableQueryTests.java b/src/test/java/org/elasticsearch/common/lucene/IndexCacheableQueryTests.java index 5192e6f9e28..5d418d185d2 100644 --- a/src/test/java/org/elasticsearch/common/lucene/IndexCacheableQueryTests.java +++ b/src/test/java/org/elasticsearch/common/lucene/IndexCacheableQueryTests.java @@ -105,6 +105,7 @@ public class IndexCacheableQueryTests extends ElasticsearchTestCase { IndexReader reader = writer.getReader(); IndexSearcher searcher = newSearcher(reader); + reader = searcher.getIndexReader(); // reader might be wrapped searcher.setQueryCache(cache); searcher.setQueryCachingPolicy(policy); @@ -118,8 +119,9 @@ public class IndexCacheableQueryTests extends ElasticsearchTestCase { writer.addDocument(new Document()); - DirectoryReader reader2 = writer.getReader(); + IndexReader reader2 = writer.getReader(); searcher = newSearcher(reader2); + reader2 = searcher.getIndexReader(); // reader might be wrapped searcher.setQueryCache(cache); searcher.setQueryCachingPolicy(policy);