mirror of https://github.com/apache/lucene.git
Fix tests reproducibility.
Some tests instantiate an IndexSearcher in an @BeforeClass method. So we need to reset the query cache in @BeforeClass too or they would use a shared cache. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1664053 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4d6df6a480
commit
5406a2ae14
|
@ -1651,7 +1651,15 @@ public abstract class LuceneTestCase extends Assert {
|
|||
}
|
||||
|
||||
@Before
|
||||
public void resetDefaultQueryCache() {
|
||||
public void resetTestDefaultQueryCache() {
|
||||
// Make sure each test method has its own cache
|
||||
resetDefaultQueryCache();
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void resetDefaultQueryCache() {
|
||||
// we need to reset the query cache in an @BeforeClass so that tests that
|
||||
// instantiate an IndexSearcher in an @BeforeClass method use a fresh new cache
|
||||
IndexSearcher.setDefaultQueryCache(new LRUQueryCache(10000, 1 << 25));
|
||||
IndexSearcher.setDefaultQueryCachingPolicy(MAYBE_CACHE_POLICY);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue