use of org.jenkinsci.test.acceptance.junit.Native in project acceptance-test-harness by jenkinsci.
the class GroovyPluginTest method use_native_groovy.
@Test
@Native("groovy")
public void use_native_groovy() {
GroovyInstallation groovy = ToolInstallation.addTool(jenkins, GroovyInstallation.class);
groovy.name.set("local-groovy");
groovy.useNative();
groovy.getPage().save();
configureJob();
final GroovyStep step = job.addBuildStep(GroovyStep.class);
step.version.select("local-groovy");
step.script("println 'version: ' + groovy.lang.GroovySystem.getVersion()");
job.save();
Build build = job.startBuild().shouldSucceed();
String expectedVersion = localGroovyVersion();
build.shouldContainsConsoleOutput("version: " + expectedVersion);
}
use of org.jenkinsci.test.acceptance.junit.Native in project acceptance-test-harness by jenkinsci.
the class JdkTest method usePreinstalledJdk.
// This actually tests any installed JDK, not necessarily oracle.
@Test
@Native("java")
public void usePreinstalledJdk() {
String expectedVersion = localJavaVersion();
JdkInstallation jdk = ToolInstallation.addTool(jenkins, JdkInstallation.class);
jdk.name.set("preinstalled");
jdk.useNative();
jdk.getPage().save();
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.addShellStep("java -version");
job.save();
job.startBuild().shouldSucceed().shouldContainsConsoleOutput(expectedVersion);
}
use of org.jenkinsci.test.acceptance.junit.Native in project acceptance-test-harness by jenkinsci.
the class AntPluginTest method locallyInstalledAnt.
@Test
@Native("ant")
public void locallyInstalledAnt() {
AntInstallation ant = ToolInstallation.addTool(jenkins, AntInstallation.class);
ant.name.set("native_ant");
String antHome = ant.useNative();
ant.getPage().save();
job.configure();
job.copyResource(resource("ant/echo-helloworld.xml"), "build.xml");
AntBuildStep step = job.addBuildStep(AntBuildStep.class);
step.antName.select("native_ant");
step.targets.set("-version");
job.save();
String expectedVersion = localAntVersion(antHome);
job.startBuild().shouldSucceed().shouldContainsConsoleOutput(Pattern.quote(expectedVersion));
}
use of org.jenkinsci.test.acceptance.junit.Native in project acceptance-test-harness by jenkinsci.
the class WorkflowPluginTest method parallelTests.
@WithPlugins({ "workflow-job", "workflow-cps@2.10", "workflow-basic-steps@2.1", "workflow-durable-task-step", "parallel-test-executor@1.11", "junit@1.18", "git@2.3" })
@Native("mvn")
@Test
public void parallelTests() throws Exception {
for (int i = 0; i < 3; i++) {
slaveController.install(jenkins);
}
WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
job.script.set("node('built-in || master') {\n" + // TODO could be switched to multibranch, in which case this initial `node` is unnecessary, and each branch can just `checkout scm`
" git 'https://github.com/jenkinsci/parallel-test-executor-plugin-sample.git'\n" + " stash 'sources'\n" + "}\n" + "def splits = splitTests parallelism: count(3), estimateTestsFromFiles: true\n" + "def branches = [:]\n" + "for (int i = 0; i < splits.size(); i++) {\n" + " def exclusions = splits.get(i);\n" + " branches[\"split${i}\"] = {\n" + " node('!master') {\n" + " sh 'rm -rf *'\n" + " unstash 'sources'\n" + " writeFile file: 'exclusions.txt', text: exclusions.join(\"\\n\")\n" + // TODO would be useful for ToolInstallation to support the URL installer, hosting the tool ZIP ourselves somewhere cached.
" sh 'mvn -B -Dmaven.test.failure.ignore test'\n" + " junit 'target/surefire-reports/*.xml'\n" + " }\n" + " }\n" + "}\n" + "parallel branches");
job.sandbox.check();
job.save();
Build build = job.startBuild();
try {
build.shouldSucceed();
} catch (AssertionError x) {
// cf. linearFlow
build.shouldBeUnstable();
}
assertThat(build.getConsole(), containsString("No record available"));
build = job.startBuild();
try {
build.shouldSucceed();
} catch (AssertionError x) {
build.shouldBeUnstable();
}
assertThat(build.getConsole(), containsString("divided into 3 sets"));
}
Aggregations