use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class FreestyleJobTest method doNotDiscardSuccessfulBuilds.
@Test
@Category(SmokeTest.class)
public void doNotDiscardSuccessfulBuilds() {
FreeStyleJob j = jenkins.jobs.create(FreeStyleJob.class);
j.configure();
try {
check("Discard old builds");
} catch (NoSuchElementException x) {
// 1.636-
check("Discard Old Builds");
}
j.control(by.name("_.numToKeepStr")).set(1);
ShellBuildStep shellBuildStep = j.addShellStep("exit 0");
j.save();
Build b1 = j.scheduleBuild().waitUntilFinished();
j.configure();
shellBuildStep.command("exit 1");
j.save();
Build b2 = j.scheduleBuild().waitUntilFinished();
Build b3 = j.scheduleBuild().waitUntilFinished();
assertThat(b1, pageObjectExists());
assertThat(b2, pageObjectDoesNotExist());
assertThat(b3, pageObjectExists());
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class DeployPluginTest method deploy_sample_webapp_to_tomcat7.
@Test
@Native("bash")
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { "admin", "tomcat" }, id = "tomcat")
public void deploy_sample_webapp_to_tomcat7() throws IOException, InterruptedException {
if (SystemUtils.IS_OS_WINDOWS) {
// TODO move somewhere else...
String path = new CommandBuilder("where.exe", "bash.exe").popen().asText().trim();
// where will return all matches and we only want the first.
path = path.replaceAll("\r\n.*", "");
JenkinsConfig conf = jenkins.getConfigPage();
JenkinsConfig cp = jenkins.getConfigPage();
cp.configure();
cp.setShell(path);
cp.save();
}
Tomcat7Container f = docker.get();
FreeStyleJob j = jenkins.jobs.create();
j.configure();
ShellBuildStep s;
{
s = j.addShellStep(resource("/deploy_plugin/build-war.sh"));
DeployPublisher d = j.addPublisher(DeployPublisher.class);
d.war.set("my-webapp/target/*.war");
d.contextPath.set("test");
d.useContainer("Tomcat 7.x Remote", "Tomcat 7.x");
d.setCredentials("tomcat");
d.url.set(f.getUrl().toExternalForm());
}
j.save();
Build b = j.startBuild().shouldSucceed();
b.shouldContainsConsoleOutput("to container Tomcat 7.x Remote");
assertThat(readText(f), containsString("Hello World!"));
j.configure();
s.command("cd my-webapp && echo '<html><body>Hello Jenkins</body></html>' > src/main/webapp/index.jsp && mvn install");
j.save();
b = j.startBuild().shouldSucceed();
b.shouldContainsConsoleOutput("Redeploying");
assertThat(readText(f), containsString("Hello Jenkins"));
}
use of org.jenkinsci.test.acceptance.po.ShellBuildStep in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method createAndBuildCompileJobOnAgent.
private WarningsAction createAndBuildCompileJobOnAgent(Resource resource, String command) {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource);
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(command);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = buildSuccessfulJob(job);
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
action.open();
return action;
}
Aggregations