mirror of
https://github.com/apache/lucene.git
synced 2025-03-03 23:09:36 +00:00
revert the static boolean checkFieldCacheSanity that yonik added for SOLR-1875. since it's in the base class it's dangerous if some test class sets it to false and never sets it back to true. added additional comments to where assertSaneFieldCaches is called so that if people run into the same situation yonik did in hte future they'll see how to deal with it (either by refactoring, or by using purgeFieldCache)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@939889 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a29adfc6e
commit
220f9ee81c
@ -93,8 +93,6 @@ public class LuceneTestCaseJ4 {
|
||||
*/
|
||||
public static final Version TEST_VERSION_CURRENT = Version.LUCENE_31;
|
||||
|
||||
public static boolean checkFieldCacheSanity = true;
|
||||
|
||||
/** Create indexes in this directory, optimally use a subdir, named after the test */
|
||||
public static final File TEMP_DIR;
|
||||
static {
|
||||
@ -195,12 +193,19 @@ public class LuceneTestCaseJ4 {
|
||||
public void tearDown() throws Exception {
|
||||
BooleanQuery.setMaxClauseCount(savedBoolMaxClauseCount);
|
||||
try {
|
||||
// this isn't as useful as calling directly from the scope where the
|
||||
// index readers are used, because they could be gc'ed just before
|
||||
// tearDown is called.
|
||||
// calling assertSaneFieldCaches here isn't as useful as having test
|
||||
// classes call it directly from the scope where the index readers
|
||||
// are used, because they could be gc'ed just before this tearDown
|
||||
// method is called.
|
||||
//
|
||||
// But it's better then nothing.
|
||||
if (checkFieldCacheSanity)
|
||||
assertSaneFieldCaches(getTestLabel());
|
||||
//
|
||||
// If you are testing functionality that you know for a fact
|
||||
// "violates" FieldCache sanity, then you should either explicitly
|
||||
// call purgeFieldCache at the end of your test method, or refactor
|
||||
// your Test class so that the inconsistant FieldCache usages are
|
||||
// isolated in distinct test methods
|
||||
assertSaneFieldCaches(getTestLabel());
|
||||
|
||||
if (ConcurrentMergeScheduler.anyUnhandledExceptions()) {
|
||||
// Clear the failure so that we don't just keep
|
||||
|
Loading…
x
Reference in New Issue
Block a user