Search in sources :

Example 1 with ReverseBuildTrigger

use of jenkins.triggers.ReverseBuildTrigger in project workflow-job-plugin by jenkinsci.

the class ReverseBuildTriggerTest method upstreamMapRebuilding.

@Issue("JENKINS-33971")
@Test
public void upstreamMapRebuilding() throws Exception {
    story.then(r -> {
        r.jenkins.setQuietPeriod(0);
        WorkflowJob us = r.jenkins.createProject(WorkflowJob.class, "us");
        us.setDefinition(new CpsFlowDefinition("", true));
        // force it to load after ds when we restart
        us.addProperty(new SlowToLoad());
        WorkflowJob ds = r.jenkins.createProject(WorkflowJob.class, "ds");
        ds.setDefinition(new CpsFlowDefinition("", true));
        ds.addTrigger(new ReverseBuildTrigger("us", Result.SUCCESS));
        r.assertBuildStatusSuccess(us.scheduleBuild2(0));
        r.waitUntilNoActivity();
        WorkflowRun ds1 = ds.getLastCompletedBuild();
        assertNotNull(ds1);
        assertEquals(1, ds1.getNumber());
    });
    story.then(r -> {
        WorkflowJob us = r.jenkins.getItemByFullName("us", WorkflowJob.class);
        assertNotNull(us);
        WorkflowJob ds = r.jenkins.getItemByFullName("ds", WorkflowJob.class);
        assertNotNull(ds);
        r.assertBuildStatusSuccess(us.scheduleBuild2(0));
        r.waitUntilNoActivity();
        WorkflowRun ds2 = ds.getLastCompletedBuild();
        assertNotNull(ds2);
        assertEquals(2, ds2.getNumber());
    });
}
Also used : CpsFlowDefinition(org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition) ReverseBuildTrigger(jenkins.triggers.ReverseBuildTrigger) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test)

Aggregations

ReverseBuildTrigger (jenkins.triggers.ReverseBuildTrigger)1 CpsFlowDefinition (org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition)1 Test (org.junit.Test)1 Issue (org.jvnet.hudson.test.Issue)1