Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1 from jglick/1.580
[FIXED JENKINS-25446] Make this runnable against 1.580.x
  • Loading branch information
seriousamlqz committed Mar 25, 2015
2 parents 9ad1897 + cb12c52 commit c68997a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions pom.xml
Expand Up @@ -20,13 +20,13 @@ limitations under the License.
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.568</version><!-- which version of Jenkins is this plugin built against? Users must have at least this Jenkins version to use this plugin. -->
<version>1.580.1</version>
</parent>

<artifactId>flaky-test-handler</artifactId>
<name>Flaky Test Handler plugin</name>
<description>Display rerun flaky tests</description>
<version>1.0.1</version>
<version>1.1-SNAPSHOT</version>
<packaging>hpi</packaging>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Flaky+Test+Handler+Plugin</url>

Expand Down Expand Up @@ -76,6 +76,11 @@ limitations under the License.
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Expand Up @@ -75,7 +75,8 @@ public class FlakyTestResultAction implements RunAction2 {
*/
public FlakyTestResultAction(AbstractBuild build, BuildListener listener) {
this.build = build;
AbstractTestResultAction action = build.getTestResultAction();
// TODO consider the possibility that there is >1 such action
AbstractTestResultAction action = build.getAction(AbstractTestResultAction.class);
if (action != null) {
Object latestResult = action.getResult();
if (latestResult != null && latestResult instanceof TestResult) {
Expand Down
Expand Up @@ -28,6 +28,7 @@
import hudson.tasks.junit.TestDataPublisher;
import hudson.tasks.junit.TestResult;
import hudson.tasks.junit.TestResultAction;
import hudson.tasks.test.AbstractTestResultAction;

/**
* Publisher for publishing rerun information
Expand All @@ -46,7 +47,8 @@ public TestResultAction.Data getTestData(AbstractBuild<?, ?> abstractBuild, Laun
BuildListener buildListener, TestResult testResult)
throws IOException, InterruptedException {
FlakyTestResult flakyTestResult = new FlakyTestResult(testResult);
flakyTestResult.freeze(abstractBuild.getTestResultAction(), abstractBuild);
// TODO consider the possibility that there is >1 such action
flakyTestResult.freeze(abstractBuild.getAction(AbstractTestResultAction.class), abstractBuild);
return new JUnitFlakyTestData(flakyTestResult);
}

Expand Down
Expand Up @@ -50,6 +50,7 @@ public DeflakeListener() {
// Add deflake action to the build and aggregate test running stats from this build
@Override
public void onCompleted(AbstractBuild build, TaskListener listener) {
// TODO consider the possibility that there is >1 such action
TestResultAction testResultAction = build.getAction(TestResultAction.class);

HistoryAggregatedFlakyTestResultAction historyAction = build.getProject()
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/hudson/plugins/git/AbstractGitTestCase.java
Expand Up @@ -45,6 +45,7 @@
import hudson.remoting.VirtualChannel;
import hudson.slaves.EnvironmentVariablesNodeProperty;
import hudson.util.StreamTaskListener;
import jenkins.MasterToSlaveFileCallable;


/**
Expand Down Expand Up @@ -227,7 +228,7 @@ protected void setVariables(Node node, EnvironmentVariablesNodeProperty.Entry...
}

protected String getHeadRevision(AbstractBuild build, final String branch) throws IOException, InterruptedException {
return build.getWorkspace().act(new FilePath.FileCallable<String>() {
return build.getWorkspace().act(new MasterToSlaveFileCallable<String>() {
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
try {
ObjectId oid = Git.with(null, null).in(f).getClient().getRepository().resolve("refs/heads/" + branch);
Expand Down

0 comments on commit c68997a

Please sign in to comment.