Merge pull request #13268 from brwe/test-start-end

[test] print test start and end of test setup and cleanup
This commit is contained in:
Britta Weber 2015-09-02 19:44:40 +02:00
commit 3d5128db07
1 changed files with 9 additions and 4 deletions

View File

@ -344,7 +344,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
cluster().beforeTest(getRandom(), getPerTestTransportClientRatio()); cluster().beforeTest(getRandom(), getPerTestTransportClientRatio());
cluster().wipe(); cluster().wipe();
randomIndexTemplate(); randomIndexTemplate();
printTestMessage("before");
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {
if (e.getMessage().contains("unable to create new native thread")) { if (e.getMessage().contains("unable to create new native thread")) {
ESTestCase.printStackDump(logger); ESTestCase.printStackDump(logger);
@ -354,7 +353,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
} }
private void printTestMessage(String message) { private void printTestMessage(String message) {
if (isSuiteScopedTest(getClass())) { if (isSuiteScopedTest(getClass()) && (getTestName().equals("<unknown>"))) {
logger.info("[{}]: {} suite", getTestClass().getSimpleName(), message); logger.info("[{}]: {} suite", getTestClass().getSimpleName(), message);
} else { } else {
logger.info("[{}#{}]: {} test", getTestClass().getSimpleName(), getTestName(), message); logger.info("[{}#{}]: {} test", getTestClass().getSimpleName(), getTestName(), message);
@ -593,7 +592,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
boolean success = false; boolean success = false;
try { try {
final Scope currentClusterScope = getCurrentClusterScope(); final Scope currentClusterScope = getCurrentClusterScope();
printTestMessage("cleaning up after");
clearDisruptionScheme(); clearDisruptionScheme();
try { try {
if (cluster() != null) { if (cluster() != null) {
@ -618,7 +616,6 @@ public abstract class ESIntegTestCase extends ESTestCase {
clearClusters(); // it is ok to leave persistent / transient cluster state behind if scope is TEST clearClusters(); // it is ok to leave persistent / transient cluster state behind if scope is TEST
} }
} }
printTestMessage("cleaned up after");
success = true; success = true;
} finally { } finally {
if (!success) { if (!success) {
@ -1953,20 +1950,26 @@ public abstract class ESIntegTestCase extends ESTestCase {
@Before @Before
public final void before() throws Exception { public final void before() throws Exception {
if (runTestScopeLifecycle()) { if (runTestScopeLifecycle()) {
printTestMessage("setup");
beforeInternal(); beforeInternal();
} }
printTestMessage("starting");
} }
@After @After
public final void after() throws Exception { public final void after() throws Exception {
printTestMessage("finished");
// Deleting indices is going to clear search contexts implicitely so we // Deleting indices is going to clear search contexts implicitely so we
// need to check that there are no more in-flight search contexts before // need to check that there are no more in-flight search contexts before
// we remove indices // we remove indices
super.ensureAllSearchContextsReleased(); super.ensureAllSearchContextsReleased();
if (runTestScopeLifecycle()) { if (runTestScopeLifecycle()) {
printTestMessage("cleaning up after");
afterInternal(false); afterInternal(false);
printTestMessage("cleaned up after");
} }
} }
@ -1974,6 +1977,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
public static void afterClass() throws Exception { public static void afterClass() throws Exception {
if (!runTestScopeLifecycle()) { if (!runTestScopeLifecycle()) {
try { try {
INSTANCE.printTestMessage("cleaning up after");
INSTANCE.afterInternal(true); INSTANCE.afterInternal(true);
} finally { } finally {
INSTANCE = null; INSTANCE = null;
@ -1999,6 +2003,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
INSTANCE = (ESIntegTestCase) targetClass.newInstance(); INSTANCE = (ESIntegTestCase) targetClass.newInstance();
boolean success = false; boolean success = false;
try { try {
INSTANCE.printTestMessage("setup");
INSTANCE.beforeInternal(); INSTANCE.beforeInternal();
INSTANCE.setupSuiteScopeCluster(); INSTANCE.setupSuiteScopeCluster();
success = true; success = true;