[
https://issues.apache.org/jira/browse/SOLR-13574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hoss Man updated SOLR-13574:
----------------------------
Attachment: SOLR-13574.patch
Status: Open (was: Open)
Ok, here's what i've got ... i's a big patch, but it's mainly lots of little
stuff like this in After/AfterClass metods...
{noformat}
- solrClient.close();
+ if (null != solrClient) {
+ solrClient.close();
+ solrClient = null;
+ }
{noformat}
To "test the tests" I also added this to {{SolrTestCase}} ...
{code}
/**
* Special hook for sanity checking if any tests trigger failures when an
* Assumption failure occures in a {@link BeforeClass} method
* @lucene.internal
*/
@BeforeClass
public static void checkSyspropForceBeforeClassAssumptionFailure() {
// ant test -Dargs="-Dtests.force.assumption.failure.beforeclass=true"
final String PROP = "tests.force.assumption.failure.beforeclass";
assumeFalse(PROP + " == true",
systemPropertyAsBoolean(PROP, false));
}
/**
* Special hook for sanity checking if any tests trigger failures when an
* Assumption failure occures in a {@link Before} method
* @lucene.internal
*/
@Before
public void checkSyspropForceBeforeAssumptionFailure() {
// ant test -Dargs="-Dtests.force.assumption.failure.before=true"
final String PROP = "tests.force.assumption.failure.before";
assumeFalse(PROP + " == true",
systemPropertyAsBoolean(PROP, false));
}
{code}
...but it currently requires manual testing -- adding a hook for this to the
build.xml seems like something that might be worth considering later? not sure.
(Ideally it would be something the Runner could implement directly w/o these
hooks in SolrTestCase? ... need to think about it)
I should point out: even w/this in place, and when using either of those sys
props, some tests still run (so evidently we still don't have all tests
extending SolrTestCase) but this should be a good enough starting point to make
the changes in SOLR-12988 possible.
----
I'll plan to commit this soon unless anyone sees any problems?
> harden tests that fail (usually NPE) during After/AfterClas methods if there
> is an assumption violation in Before/BeforeClass methods
> -------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-13574
> URL: https://issues.apache.org/jira/browse/SOLR-13574
> Project: Solr
> Issue Type: Task
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Hoss Man
> Assignee: Hoss Man
> Priority: Major
> Attachments: SOLR-13574.patch
>
>
> We have a bunch of tests that blindly try to call cleanup methods on objects
> w/o sanity checking if the object exists and the cleanup is actually
> neccessary -- which may not be true, particularly there was an Assumption
> failure during a Before/BeforeClass method
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]