Search in sources :

Example 11 with CollectorElement

use of io.strimzi.test.logs.CollectorElement in project strimzi-kafka-operator by strimzi.

the class TestExecutionWatcher method handleBeforeEachMethodExecutionException.

@Override
public void handleBeforeEachMethodExecutionException(ExtensionContext extensionContext, Throwable throwable) throws Throwable {
    LOGGER.error("{} - Exception {} has been thrown in @BeforeEach. Going to collect logs from components.", extensionContext.getRequiredTestClass().getSimpleName(), throwable.getMessage());
    if (!(throwable instanceof TestAbortedException)) {
        final String testClass = extensionContext.getRequiredTestClass().getName();
        final String testMethod = extensionContext.getRequiredTestMethod().getName();
        collectLogs(extensionContext, new CollectorElement(testClass, testMethod));
    }
    throw throwable;
}
Also used : TestAbortedException(org.opentest4j.TestAbortedException) CollectorElement(io.strimzi.test.logs.CollectorElement)

Example 12 with CollectorElement

use of io.strimzi.test.logs.CollectorElement in project strimzi-kafka-operator by strimzi.

the class TestExecutionWatcher method handleAfterAllMethodExecutionException.

@Override
public void handleAfterAllMethodExecutionException(ExtensionContext extensionContext, Throwable throwable) throws Throwable {
    LOGGER.error("{} - Exception {} has been thrown in @AfterAll. Going to collect logs from components.", extensionContext.getRequiredTestClass().getSimpleName(), throwable.getMessage());
    final String testClass = extensionContext.getRequiredTestClass().getName();
    SuiteThreadController suiteThreadController = SuiteThreadController.getInstance();
    if (StUtils.isParallelSuite(extensionContext)) {
        suiteThreadController.removeParallelSuite(extensionContext);
    }
    if (StUtils.isIsolatedSuite(extensionContext)) {
        suiteThreadController.unLockIsolatedSuite();
    }
    collectLogs(extensionContext, new CollectorElement(testClass));
    throw throwable;
}
Also used : SuiteThreadController(io.strimzi.systemtest.parallel.SuiteThreadController) CollectorElement(io.strimzi.test.logs.CollectorElement)

Aggregations

CollectorElement (io.strimzi.test.logs.CollectorElement)12 TestAbortedException (org.opentest4j.TestAbortedException)6 SuiteThreadController (io.strimzi.systemtest.parallel.SuiteThreadController)2