mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 20:12:14 +00:00
[FIXED JENKINS-18410] AbstractTestResultAction should be a RunAction2 so it need not persist its owning build.
This commit is contained in:
1 parent
9679a6123e
commit
fcdf749912
10 files changed
+59
-14
No files matched your search
@@ -61,6 +61,9 @@ Upcoming changes</a>
|
||||
<li class=bug>
|
||||
Hudson shows 0GB free space when space available drops below 1GB.
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-7776">issue 7776</a>)
|
||||
<li class=bug>
|
||||
Avoiding serializing the owning build as part of a test result action, as this can lead to errors later.
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18410">issue 18410</a>)
|
||||
<li class=rfe>
|
||||
Added filter field for installed plugins tab.
|
||||
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-20219">issue 20219</a>)
|
||||
|
||||
@@ -133,6 +133,7 @@ public class JUnitResultArchiver extends Recorder implements MatrixAggregatable
|
||||
TestResult result = parse(testResults, build, launcher, listener);
|
||||
|
||||
try {
|
||||
// TODO can the build argument be omitted now, or is it used prior to the call to addAction?
|
||||
action = new TestResultAction(build, result, listener);
|
||||
} catch (NullPointerException npe) {
|
||||
throw new AbortException(Messages.JUnitResultArchiver_BadXML(testResults));
|
||||
@@ -173,7 +174,7 @@ public class JUnitResultArchiver extends Recorder implements MatrixAggregatable
|
||||
return true;
|
||||
}
|
||||
|
||||
build.getActions().add(action);
|
||||
build.addAction(action);
|
||||
CHECKPOINT.report();
|
||||
|
||||
if (action.getResult().getFailCount() > 0)
|
||||
|
||||
@@ -62,11 +62,17 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
|
||||
private Integer totalCount;
|
||||
private List<Data> testData = new ArrayList<Data>();
|
||||
|
||||
@Deprecated
|
||||
public TestResultAction(AbstractBuild owner, TestResult result, BuildListener listener) {
|
||||
super(owner);
|
||||
setResult(result, listener);
|
||||
}
|
||||
|
||||
/** @since 1.544 */
|
||||
public TestResultAction(TestResult result, BuildListener listener) {
|
||||
this(null, result, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites the {@link TestResult} by a new data set.
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,14 @@ import hudson.model.*;
|
||||
import hudson.tasks.junit.CaseResult;
|
||||
import hudson.util.*;
|
||||
import hudson.util.ChartUtil.NumberOnlyBuildLabel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import jenkins.model.RunAction2;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.axis.CategoryAxis;
|
||||
@@ -44,13 +52,6 @@ import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Common base class for recording test result.
|
||||
*
|
||||
@@ -61,15 +62,28 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@ExportedBean
|
||||
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> implements HealthReportingAction {
|
||||
public final AbstractBuild<?,?> owner;
|
||||
public abstract class AbstractTestResultAction<T extends AbstractTestResultAction> implements HealthReportingAction, RunAction2 {
|
||||
public transient AbstractBuild<?,?> owner;
|
||||
|
||||
private Map<String,String> descriptions = new ConcurrentHashMap<String, String>();
|
||||
|
||||
/** @since 1.544 */
|
||||
protected AbstractTestResultAction() {}
|
||||
|
||||
/** @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action. */
|
||||
@Deprecated
|
||||
protected AbstractTestResultAction(AbstractBuild owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override public void onAttached(Run<?, ?> r) {
|
||||
this.owner = (AbstractBuild<?,?>) r;
|
||||
}
|
||||
|
||||
@Override public void onLoad(Run<?, ?> r) {
|
||||
this.owner = (AbstractBuild<?,?>) r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of failed tests.
|
||||
*/
|
||||
|
||||
@@ -67,10 +67,14 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
|
||||
*/
|
||||
public final List<Child> children = new ArrayList<Child>();
|
||||
|
||||
@Deprecated
|
||||
public AggregatedTestResultAction(AbstractBuild owner) {
|
||||
super(owner);
|
||||
}
|
||||
|
||||
/** @since 1.544 */
|
||||
public AggregatedTestResultAction() {}
|
||||
|
||||
protected void update(List<? extends AbstractTestResultAction> children) {
|
||||
failCount = skipCount = totalCount = 0;
|
||||
this.children.clear();
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AggregatedTestResultPublisher extends Recorder {
|
||||
|
||||
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
|
||||
// add a TestResult just so that it can show up later.
|
||||
build.addAction(new TestResultAction(jobs,includeFailedBuilds,build));
|
||||
build.addAction(new TestResultAction(jobs, includeFailedBuilds));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -131,6 +131,11 @@ public class AggregatedTestResultPublisher extends Recorder {
|
||||
private transient List<AbstractProject> didntRun;
|
||||
private transient List<AbstractProject> noFingerprints;
|
||||
|
||||
public TestResultAction(String jobs, boolean includeFailedBuilds) {
|
||||
this(jobs, includeFailedBuilds, null);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public TestResultAction(String jobs, boolean includeFailedBuilds, AbstractBuild<?,?> owner) {
|
||||
super(owner);
|
||||
this.includeFailedBuilds = includeFailedBuilds;
|
||||
|
||||
@@ -38,10 +38,15 @@ import hudson.model.Action;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class MatrixTestResult extends AggregatedTestResultAction {
|
||||
|
||||
@Deprecated
|
||||
public MatrixTestResult(MatrixBuild owner) {
|
||||
super(owner);
|
||||
}
|
||||
|
||||
/** @since 1.544 */
|
||||
public MatrixTestResult() {}
|
||||
|
||||
/**
|
||||
* Use the configuration name.
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TestResultAggregator extends MatrixAggregator {
|
||||
|
||||
@Override
|
||||
public boolean startBuild() throws InterruptedException, IOException {
|
||||
result = new MatrixTestResult(build);
|
||||
result = new MatrixTestResult();
|
||||
build.addAction(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,12 +32,19 @@ import org.kohsuke.stapler.StaplerProxy;
|
||||
public class TrivialTestResultAction extends AbstractTestResultAction<TrivialTestResultAction> implements StaplerProxy {
|
||||
|
||||
protected TrivialTestResult result;
|
||||
|
||||
@Deprecated
|
||||
protected TrivialTestResultAction(AbstractBuild owner, TrivialTestResult result) {
|
||||
super(owner);
|
||||
this.result = result;
|
||||
this.result.setParentAction(this);
|
||||
}
|
||||
|
||||
/** @since 1.544 */
|
||||
protected TrivialTestResultAction(TrivialTestResult result) {
|
||||
this(null, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of failed tests.
|
||||
*/
|
||||
|
||||
@@ -48,9 +48,9 @@ public class TrivialTestResultRecorder extends Recorder implements Serializable
|
||||
System.out.println("performing TrviialTestResultRecorder");
|
||||
listener.getLogger().println("perfoming TrivialTestResultRecorder");
|
||||
TrivialTestResult r = new TrivialTestResult("gubernatorial");
|
||||
TrivialTestResultAction action = new TrivialTestResultAction(build, r);
|
||||
TrivialTestResultAction action = new TrivialTestResultAction(r);
|
||||
r.setParentAction(action);
|
||||
build.getActions().add(action);
|
||||
build.addAction(action);
|
||||
listener.getLogger().println("done with TrivialTestResultRecorder");
|
||||
System.out.println("done with TrivialTestResultRecorder");
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user