Tests: dump all thread stacks on failure

This commit is contained in:
Michael McCandless 2014-10-09 10:14:19 -04:00 committed by mikemccand
parent ede60df804
commit 3729b8dbd6
1 changed files with 5 additions and 5 deletions

View File

@ -605,13 +605,13 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
} }
logger.info("[{}#{}]: cleaned up after test", getTestClass().getSimpleName(), getTestName()); logger.info("[{}#{}]: cleaned up after test", getTestClass().getSimpleName(), getTestName());
success = true; success = true;
} catch (OutOfMemoryError e) {
if (e.getMessage().contains("unable to create new native thread")) {
ElasticsearchTestCase.printStackDump(logger);
}
throw e;
} finally { } finally {
if (!success || CurrentTestFailedMarker.testFailed()) { if (!success || CurrentTestFailedMarker.testFailed()) {
logger.info("[{}#{}]: now dump all thread stacks on failure", getTestClass().getSimpleName(), getTestName());
ElasticsearchTestCase.printStackDump(logger);
logger.info("[{}#{}]: done dump all thread stacks on failure", getTestClass().getSimpleName(), getTestName());
// if we failed that means that something broke horribly so we should // if we failed that means that something broke horribly so we should
// clear all clusters and if the current cluster is the global we shut that one // clear all clusters and if the current cluster is the global we shut that one
// down as well to prevent subsequent tests from failing due to the same problem. // down as well to prevent subsequent tests from failing due to the same problem.