use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class GlobalPublishPluginTest method publish_with_no_default_exclude.
@Test
public void publish_with_no_default_exclude() {
DockerContainer dock = container.get();
Resource cpTxt = resource("/ftp_plugin/odes.txt");
FreeStyleJob j = jenkins.jobs.create();
configurePublisher("asd", dock);
j.configure();
{
j.copyResource(cpTxt, ".svn");
j.copyResource(cpTxt, "CVS");
j.copyResource(cpTxt);
PublishGlobalPublisher fp = addGlobalPublisher(j);
PublishGlobalPublisher.GlobalPublishSite fps = fp.getDefault();
fps.getDefaultTransfer().sourceFile.set(".svn,CVS,odes.txt");
fps.getDefaultTransfer().noDefaultExcludes.check();
}
j.save();
j.startBuild().shouldSucceed();
assertThat(dock.cp("/tmp/odes.txt", "/tmp/"), is(true));
assertThat(dock.cp("/tmp/.svn", "/tmp/"), is(true));
assertThat(dock.cp("/tmp/CVS", "/tmp/"), is(true));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_detect_warnings_with_groovy_parser.
/**
* Checks that a dynamic Groovy parser correctly detects a warning.
*/
@Test
public void should_detect_warnings_with_groovy_parser() {
String parserName = createParser(LEGAL_PARSER_SCRIPT);
FreeStyleJob job = createJobWithParser(parserName);
Build build = buildSuccessfulJob(job);
String header = parserName + GroovyParser.LINK_SUFFIX;
assertThatActionExists(job, build, header);
assertThat(driver, hasContent(header + ": 2 warnings from one analysis."));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class TSRBuildTimeoutPluginTest method fail_build_with_absolute_time.
/**
* # TODO: The build-timeout plugin doesn't allow timeouts less than 3 minutes
* # in duration.
* #JENKINS-19592
* @wip
* Scenario: Fail a blocked build with absolute timeouts
* Given I have installed the "build-timeout" plugin
* And a job
* When I configure the job
* And I add a shell build step "sleep 200"
* And I set the build timeout to 3 minutes
* And I set abort build description
* And I save the job
* And I build the job
* Then the build should fail
*/
@Test
public void fail_build_with_absolute_time() {
FreeStyleJob j = jenkins.jobs.create();
j.configure();
{
j.addShellStep("sleep 300");
BuildTimeout t = new BuildTimeout(j);
t.abortAfter(3);
t.writeDescription();
}
j.save();
j.startBuild().waitUntilFinished(300).shouldAbort();
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob 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");
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_save_configurations.
/**
* Verifies that all configurations, done on the job configuration page,
* are saved correctly.
*/
@Test
@WithPlugins({ "matrix-auth@2.3", "mock-security-realm" })
public void should_save_configurations() {
FreeStyleJob seedJob = createSeedJob();
JobDslBuildStep jobDsl = seedJob.addBuildStep(JobDslBuildStep.class);
jobDsl.setScriptTargetsOnFilesystem("JobTest.groovy", "AnotherJobTest.groovy");
jobDsl.setIgnoreMissingFiles(true);
jobDsl.setIgnoreExisting(true);
jobDsl.setRemovedJobAction(JobDslRemovedJobAction.DELETE);
jobDsl.setRemovedViewAction(JobDslRemovedViewAction.DELETE);
jobDsl.setRemovedConfigFilesAction(JobDslRemovedConfigFilesAction.DELETE);
jobDsl.setLookupStrategy(JobDslLookupStrategy.SEED_JOB);
jobDsl.setAdditionalClasspath("path1", "path2");
jobDsl.setFailOnMissingPlugin(true);
jobDsl.setUnstableOnDeprecation(true);
seedJob.save();
seedJob.configure();
assertThat(jobDsl.isLookOnFilesystem(), is(true));
assertThat(jobDsl.getScriptTargetsOnFilesystem(), equalTo(new String[] { "JobTest.groovy", "AnotherJobTest.groovy" }));
assertThat(jobDsl.isIgnoreMissingFiles(), is(true));
assertThat(jobDsl.isIgnoreExisting(), is(true));
assertThat(jobDsl.getRemovedJobAction(), equalTo(JobDslRemovedJobAction.DELETE));
assertThat(jobDsl.getRemovedViewAction(), equalTo(JobDslRemovedViewAction.DELETE));
assertThat(jobDsl.getRemovedConfigFilesAction(), equalTo(JobDslRemovedConfigFilesAction.DELETE));
assertThat(jobDsl.getLookupStrategy(), equalTo(JobDslLookupStrategy.SEED_JOB));
assertThat(jobDsl.getAdditionalClasspath(), equalTo(new String[] { "path1", "path2" }));
assertThat(jobDsl.isFailOnMissingPlugin(), is(true));
assertThat(jobDsl.isUnstableOnDeprecation(), is(true));
String script = "job('JobDSL-Test') {\n" + " description('This is a description.')\n" + "}";
jobDsl.setScript(script);
seedJob.save();
seedJob.configure();
assertThat(jobDsl.isUseScriptText(), is(true));
assertThat(jobDsl.getScript(), equalTo(script));
setUpSecurity();
jenkins.login().doLogin(ADMIN);
seedJob.configure(() -> jobDsl.setUseSandbox(true));
seedJob.configure();
assertThat(jobDsl.isUseSandbox(), is(true));
}
Aggregations