use of org.jenkinsci.test.acceptance.po.FreeStyleJob 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.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_collect_warnings_even_if_build_failed.
/**
* Checks that PMD runs even if the build failed if the property 'canRunOnFailed' is set.
*/
@Test
public void should_collect_warnings_even_if_build_failed() {
FreeStyleJob job = createFreeStyleJob(settings -> {
settings.pattern.set(PATTERN_WITHOUT_WARNINGS);
settings.setCanRunOnFailed(true);
});
job.configure(() -> job.addShellStep("false"));
Build lastBuild = buildFailingJob(job);
assertThatBuildHasNoWarnings(lastBuild);
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_find_no_warnings.
/**
* Configures a job with PMD and checks that the parsed PMD file does not contain warnings.
*/
@Test
public void should_find_no_warnings() {
FreeStyleJob job = createFreeStyleJob(settings -> settings.pattern.set(PATTERN_WITHOUT_WARNINGS));
Build lastBuild = buildSuccessfulJob(job);
assertThatBuildHasNoWarnings(lastBuild);
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class PmdPluginTest method should_report_new_and_fixed_warnings_in_consecutive_builds.
/**
* Runs job two times to check if new and fixed warnings are displayed. Afterwards, the first build
* is deleted and Jenkins is restarted. Then the results of the second build are validated again: the detail
* pages should then show the same results (see JENKINS-24940).
*/
@Test
@Issue("24940")
public void should_report_new_and_fixed_warnings_in_consecutive_builds() {
assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
FreeStyleJob job = createFreeStyleJob();
Build firstBuild = buildJobAndWait(job);
editJob(PLUGIN_ROOT + "forSecondRun/pmd-warnings.xml", false, job, PmdFreestyleSettings.class);
Build lastBuild = buildSuccessfulJob(job);
assertThatPmdResultExists(job, lastBuild);
lastBuild.open();
verifyWarningCounts(lastBuild);
firstBuild.delete();
jenkins.restart();
lastBuild.open();
verifyWarningCounts(lastBuild);
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class PublishOverSSHPluginTest method ssh_key_path_and_key_password_and_exec_publishing.
@Test
public void ssh_key_path_and_key_password_and_exec_publishing() throws IOException {
SshdContainer sshd = docker.get();
Resource cp_file = resource(resourceFilePath);
File sshFile = sshd.getEncryptedPrivateKey();
FreeStyleJob j = jenkins.jobs.create();
jenkins.configure();
this.commonConfigKeyFileAndPassword(sshFile, false);
InstanceSite is = this.instanceConfig(sshd);
this.advancedConfigAllowExec(is, sshd);
jenkins.save();
this.configureJobWithExec(j, cp_file);
j.save();
j.startBuild().shouldSucceed();
sshd.cp(tempCopyFile, tempPath);
sshd.cp(tempCopyFileEcho, tempPath);
assertThat(FileUtils.readFileToString(new File(tempCopyFile)), CoreMatchers.is(cp_file.asText()));
assertThat(FileUtils.readFileToString(new File(tempCopyFileEcho)), CoreMatchers.is("i was here\n"));
}
Aggregations