Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pluggable storage: Add stdout, stderr, stacktrace, fix caseresult loading #170

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring compat break as it's beta and only user is sql plugin which will be released at the same time

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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get by package result also loads the full class result, this code before was ignoring the package and only worked in tests because we had a Klazz and a other.Klazz. and so the wrong Klazz was being picked.

Now we load from the correct package

if (result != null) {
return result;
} else {
Expand Down
Loading