-
Bug
-
Resolution: Duplicate
-
Minor
-
None
Consider the following test:
public class PublisherOrderTest extends AbstractJUnitTest { @Test public void testOrdered() { FreeStyleJob upstream = jenkins.jobs.create(FreeStyleJob.class); upstream.configure(); String command = "echo 'hello' > aggregate.txt"; if(SystemUtils.IS_OS_UNIX) { upstream.addShellStep(command); } else { upstream.addBatchStep(command); } AggregateDownstreamTestResults aggregate = upstream.addPublisher(AggregateDownstreamTestResults.class); aggregate.specify.check(); ArtifactArchiver archiver = upstream.addPublisher(ArtifactArchiver.class); archiver.includes("aggregate.txt"); BuildTrigger trigger = upstream.addPublisher(BuildTrigger.class); trigger.childProjects.set("projectName"); Fingerprint fingerprint = upstream.addPublisher(Fingerprint.class); fingerprint.targets.set("aggregate.txt"); upstream.save(); } @Test public void testUnordered() { FreeStyleJob upstream = jenkins.jobs.create(FreeStyleJob.class); upstream.configure(); String command = "echo 'hello' > aggregate.txt"; if(SystemUtils.IS_OS_UNIX) { upstream.addShellStep(command); } else { upstream.addBatchStep(command); } ArtifactArchiver archiver = upstream.addPublisher(ArtifactArchiver.class); archiver.includes("aggregate.txt"); BuildTrigger trigger = upstream.addPublisher(BuildTrigger.class); trigger.childProjects.set("projectName"); Fingerprint fingerprint = upstream.addPublisher(Fingerprint.class); fingerprint.targets.set("aggregate.txt"); AggregateDownstreamTestResults aggregate = upstream.addPublisher(AggregateDownstreamTestResults.class); aggregate.specify.check(); upstream.save(); }
The second test fails on Jenkins because the `Job.addStep' method expects Publishers to be added as a queue (FIFO order) whilst they seem to be ordered alphabetically on the UI.
An easy workaround for tests is to add the Publishers alphabetically, but that does not seem a real simulation of a test case, where users can add publishers on any order
- duplicates
-
JENKINS-37276 Path attributes can change values if reordered
- Resolved
- links to