use of org.jenkinsci.test.acceptance.junit.FailureDiagnostics in project acceptance-test-harness by jenkinsci.
the class LocalController method diagnose.
@Override
public void diagnose(Throwable cause) {
if (cause instanceof TimeoutException) {
FailureDiagnostics diagnostics = injector.getInstance(FailureDiagnostics.class);
String td = getThreaddump();
if (td != null) {
diagnostics.write("threaddump.log", td);
}
}
if (getenv("INTERACTIVE") != null && getenv("INTERACTIVE").equals("true")) {
if (cause instanceof MultipleFailureException) {
System.out.println("Multiple exceptions occurred:");
for (Throwable c : ((MultipleFailureException) cause).getFailures()) {
out.println();
c.printStackTrace(out);
out.println();
}
} else {
cause.printStackTrace(out);
}
out.println("Commencing interactive debugging. Browser session was kept open.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException e) {
return;
}
}
}
}
use of org.jenkinsci.test.acceptance.junit.FailureDiagnostics in project acceptance-test-harness by jenkinsci.
the class LocalController method diagnoseFailedLoad.
private void diagnoseFailedLoad(Exception cause) throws IOException {
String td = getThreaddump();
if (td != null) {
IOException ex = new IOException(cause.getMessage() + "\n\n" + td);
ex.setStackTrace(cause.getStackTrace());
cause = ex;
}
// Copy log to diagnostics
FailureDiagnostics diagnostics = injector.getInstance(FailureDiagnostics.class);
File log = diagnostics.touch("jenkins.log");
Files.copy(logFile.toPath(), log.toPath(), StandardCopyOption.REPLACE_EXISTING);
throw (cause instanceof IOException) ? (IOException) cause : new IOException("Jenkins failed to load", cause);
}
Aggregations