use of org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition in project workflow-job-plugin by jenkinsci.
the class WorkflowJobTest method polling.
@Issue("JENKINS-34716")
@Test
public void polling() throws Exception {
sampleRepo.init();
sampleRepo.write("Jenkinsfile", "echo 'first version'");
sampleRepo.git("add", "Jenkinsfile");
sampleRepo.git("commit", "-m", "init");
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
p.addTrigger(new SCMTrigger(""));
p.setDefinition(new CpsScmFlowDefinition(new GitSCM(sampleRepo.toString()), "Jenkinsfile"));
j.assertLogContains("first version", j.buildAndAssertSuccess(p));
sampleRepo.write("Jenkinsfile", "echo 'second version'");
sampleRepo.git("commit", "-a", "-m", "init");
j.jenkins.setQuietPeriod(0);
j.createWebClient().getPage(new WebRequest(j.createWebClient().createCrumbedUrl(p.getUrl() + "polling"), HttpMethod.POST));
j.waitUntilNoActivity();
WorkflowRun b2 = p.getLastBuild();
assertEquals(2, b2.getNumber());
j.assertLogContains("second version", b2);
}
Aggregations