mirror of https://github.com/apache/lucene.git
SOLR-7601: We should only check that tests have properly closed resources if the tests passed.
Speeds up test fails and cleans up Jenkin's failure reports. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1682454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9cc7865346
commit
d38212a458
|
@ -489,7 +489,7 @@ public abstract class LuceneTestCase extends Assert {
|
||||||
/**
|
/**
|
||||||
* Suite failure marker (any error in the test or suite scope).
|
* Suite failure marker (any error in the test or suite scope).
|
||||||
*/
|
*/
|
||||||
private static TestRuleMarkFailure suiteFailureMarker;
|
protected static TestRuleMarkFailure suiteFailureMarker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary files cleanup rule.
|
* Temporary files cleanup rule.
|
||||||
|
|
|
@ -226,13 +226,18 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
try {
|
try {
|
||||||
deleteCore();
|
deleteCore();
|
||||||
resetExceptionIgnores();
|
resetExceptionIgnores();
|
||||||
|
|
||||||
|
if (suiteFailureMarker.wasSuccessful()) {
|
||||||
|
// if the tests passed, make sure everything was closed / released
|
||||||
endTrackingSearchers();
|
endTrackingSearchers();
|
||||||
String orr = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();
|
String orr = ObjectReleaseTracker.clearObjectTrackerAndCheckEmpty();
|
||||||
if (!RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class)) {
|
if (!RandomizedContext.current().getTargetClass().isAnnotationPresent(SuppressObjectReleaseTracker.class)) {
|
||||||
assertNull(orr, orr);
|
assertNull(orr, orr);
|
||||||
} else {
|
} else {
|
||||||
if (orr != null) {
|
if (orr != null) {
|
||||||
log.warn("Some resources were not closed, shutdown, or released. This has been ignored due to the SuppressObjectReleaseTracker annotation.");
|
log.warn(
|
||||||
|
"Some resources were not closed, shutdown, or released. This has been ignored due to the SuppressObjectReleaseTracker annotation.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetFactory();
|
resetFactory();
|
||||||
|
|
Loading…
Reference in New Issue