Skip to content

Commit

Permalink
Pluggable storage: Add stdout, stderr, stacktrace, fix caseresult loa…
Browse files Browse the repository at this point in the history
…ding (#170)
  • Loading branch information
timja authored Sep 24, 2020
1 parent 77a19c8 commit a39b176
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 34 deletions.
18 changes: 14 additions & 4 deletions src/main/java/hudson/tasks/junit/CaseResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,24 @@ public CaseResult(SuiteResult parent, String testName, String errorStackTrace, S
}

@Restricted(Beta.class)
public CaseResult(SuiteResult parent, String className, String testName, String errorDetails, String skippedMessage, float duration) {
public CaseResult(
SuiteResult parent,
String className,
String testName,
String errorDetails,
String skippedMessage,
float duration,
String stdout,
String stderr,
String stacktrace
) {
this.className = className;
this.testName = testName;
this.errorStackTrace = null;
this.errorStackTrace = stacktrace;
this.errorDetails = errorDetails;
this.parent = parent;
this.stdout = null;
this.stderr = null;
this.stdout = stdout;
this.stderr = stderr;
this.duration = duration;

this.skipped = skippedMessage != null;
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/hudson/tasks/junit/PackageResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
package hudson.tasks.junit;

import hudson.model.Run;
import io.jenkins.plugins.junit.storage.FileJunitTestResultStorage;
import io.jenkins.plugins.junit.storage.TestResultImpl;
import io.jenkins.plugins.junit.storage.JunitTestResultStorage;
import hudson.tasks.test.MetaTabulatedResult;
import hudson.tasks.test.TestResult;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
Expand Down Expand Up @@ -148,15 +145,7 @@ public int getSkipCount() {

@Override
public Object getDynamic(String name, StaplerRequest req, StaplerResponse rsp) {
JunitTestResultStorage storage = JunitTestResultStorage.find();
ClassResult result;
if (!(storage instanceof FileJunitTestResultStorage)) {
Run<?, ?> run = Stapler.getCurrentRequest().findAncestorObject(Run.class);
TestResultImpl pluggableStorage = storage.load(run.getParent().getFullName(), run.getNumber());
result = pluggableStorage.getClassResult(name);
} else {
result = getClassResult(name);
}
ClassResult result = getClassResult(name);
if (result != null) {
return result;
} else {
Expand Down
Loading

0 comments on commit a39b176

Please sign in to comment.