use of org.jenkinsci.test.acceptance.plugins.jira.JiraGlobalConfig in project acceptance-test-harness by jenkinsci.
the class JiraPluginTest method jira_ticket_gets_updated_with_a_build_link.
@Test
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { USERNAME, PASSWORD }, id = CREDENTIALS_ID)
public void jira_ticket_gets_updated_with_a_build_link() throws Exception {
JiraContainer jira = docker.get();
jira.waitForReady(this);
jira.createProject("ABC");
jira.createIssue("ABC");
jira.createIssue("ABC");
jenkins.configure();
{
new JiraGlobalConfig(jenkins).addSite(jira.getURL(), CREDENTIALS_ID);
}
jenkins.save();
FreeStyleJob job = jenkins.jobs.create();
job.configure();
{
job.useScm(GitScm.class).url(git.dir.toString());
job.addPublisher(JiraUpdater.class);
}
job.save();
git.changeAndCommitFoo("initial commit");
job.startBuild().shouldSucceed();
git.changeAndCommitFoo("[ABC-1] fixed");
git.changeAndCommitFoo("[ABC-2] fixed");
Build b = job.startBuild().shouldSucceed();
b.open();
find(by.link("ABC-1"));
find(by.link("ABC-2"));
String buildUrl = job.build(b.getNumber()).url.toString();
for (RemoteComment c : jira.getComments("ABC-1")) {
if (c.getBody().contains(buildUrl)) {
return;
}
}
fail("Comment back to Jenkins not found");
}
Aggregations