Skip to content

Commit

Permalink
Merge pull request #8 from ikedam/feature/JENKINS-26452_reproduce
Browse files Browse the repository at this point in the history
[JENKINS-26452] Tests to reproduce JENKINS-26452.
  • Loading branch information
ikedam committed Jan 17, 2015
2 parents 932c255 + 2b8793a commit 6028278
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Expand Up @@ -58,6 +58,7 @@
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TestExtension;
import org.jvnet.hudson.test.recipes.LocalData;
import org.kohsuke.stapler.DataBoundConstructor;

import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
Expand Down Expand Up @@ -495,6 +496,40 @@ public void testNewInstanceDifferFromDataBoundConstructor() throws Exception {
assertEquals(DummyTestDataPublisher.class, archiver.getTestDataPublishers().get(0).getClass());
}

@Bug(26452)
public void testNoPublisher() throws Exception {
FreeStyleProject p = createFreeStyleProject();

p.getPublishersList().add(new FlexiblePublisher(Arrays.asList(
new ConditionalPublisher(
new AlwaysRun(),
Collections.<BuildStep>emptyList(),
new BuildStepRunner.Fail(),
false,
null,
null
)
)));

p.save();

// This doesn't fail till Jenkins 1.500.
reconfigure(p);

assertBuildStatusSuccess(p.scheduleBuild2(0));
assertEquals(0, p.getPublishersList().get(FlexiblePublisher.class).getPublishers().get(0).getPublisherList().size());
}

@Bug(26452)
@LocalData
public void testRecoverFrom26452() throws Exception {
FreeStyleProject p = jenkins.getItemByFullName("affectedBy26452", FreeStyleProject.class);
assertNotNull(p);

assertBuildStatusSuccess(p.scheduleBuild2(0));
assertEquals(0, p.getPublishersList().get(FlexiblePublisher.class).getPublishers().get(0).getPublisherList().size());
}

public static class DummyTestDataPublisher extends TestDataPublisher {
@DataBoundConstructor
public DummyTestDataPublisher() {
Expand Down
@@ -0,0 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<version>1.425</version>
</hudson>
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector"/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers>
<org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
<publishers>
<org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
<condition class="org.jenkins_ci.plugins.run_condition.core.AlwaysRun"/>
<publisherList>
<null/>
</publisherList>
<runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail"/>
</org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
</publishers>
</org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
</publishers>
<buildWrappers/>
</project>

0 comments on commit 6028278

Please sign in to comment.