use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.
the class OpenstackCloudPluginTest method useSingleUseSlave.
@Test
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void useSingleUseSlave() {
configureCloudInit("cloud-init");
configureProvisioning("SSH", "label");
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.setLabelExpression("label");
job.addBuildWrapper(OpenstackOneOffSlave.class);
job.save();
Build build = job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed();
assertTrue(build.getNode().isTemporarillyOffline());
}
use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.
the class OpenstackCloudPluginTest method provisionSshSlave.
@Test
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { MACHINE_USERNAME, "/openstack_plugin/unsafe" })
@TestActivation({ "HARDWARE_ID", "IMAGE_ID", "KEY_PAIR_NAME", "NETWORK_ID" })
public void provisionSshSlave() {
configureCloudInit("cloud-init");
configureProvisioning("SSH", "label");
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.setLabelExpression("label");
job.save();
job.scheduleBuild().waitUntilFinished(PROVISIONING_TIMEOUT).shouldSucceed();
}
use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_parse_codenarc_on_agent.
@Test
@Issue("JENKINS-17787")
@WithPlugins({ "violations", "ssh-slaves" })
@WithDocker
@Ignore("Reproduces JENKINS-17787")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
public void should_parse_codenarc_on_agent() {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
assertThatCodeNarcActionExists(job);
}
use of org.jenkinsci.test.acceptance.junit.WithCredentials in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_scan_console_log_of_slave_build.
@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_scan_console_log_of_slave_build() throws ExecutionException, InterruptedException {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource(RESOURCE_WARNING_MAIN_JAVA_PATH));
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(CMD_WARNING_MAIN_JAVA_CONSOLE);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = job.startBuild().shouldSucceed();
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 3);
String codeLine = action.getLinkedSourceFileText(AnalysisAction.Tab.DETAILS, "WarningMain.java", 10);
String[] codeLineArr = codeLine.trim().split("\\s+", 2);
assertThat("Warning should be at line", codeLineArr[0], is("10"));
assertThat("Assert failed comparing code line is", codeLineArr[1], is("text = (TextClass) text2;"));
}
use of org.jenkinsci.test.acceptance.junit.WithCredentials 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