Skip to content

Commit

Permalink
Merge pull request #34 from jglick/stash-JENKINS-26942
Browse files Browse the repository at this point in the history
[JENKINS-26942] Update acceptance test to use stashes
  • Loading branch information
jglick committed Oct 2, 2015
2 parents aac7425 + 6363cf3 commit 14b934c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/test/java/plugins/WorkflowPluginTest.java
Expand Up @@ -44,11 +44,11 @@
/**
* Roughly follows <a href="https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md">the tutorial</a>.
*/
@WithPlugins("workflow-aggregator@1.1")
public class WorkflowPluginTest extends AbstractJUnitTest {

@Inject private SlaveController slaveController;

@WithPlugins("workflow-aggregator@1.1")
@Test public void helloWorld() throws Exception {
WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
job.script.set("echo 'hello from Workflow'");
Expand All @@ -57,7 +57,7 @@ public class WorkflowPluginTest extends AbstractJUnitTest {
job.startBuild().shouldSucceed().shouldContainsConsoleOutput("hello from Workflow");
}

@WithPlugins({"junit@1.3", "git@2.3"})
@WithPlugins({"workflow-aggregator@1.1", "junit@1.3", "git@2.3"})
@Test public void linearFlow() throws Exception {
MavenInstallation.installMaven(jenkins, "M3", "3.1.0");
final DumbSlave slave = (DumbSlave) slaveController.install(jenkins).get();
Expand Down Expand Up @@ -107,7 +107,7 @@ public class WorkflowPluginTest extends AbstractJUnitTest {
assertThat(driver, hasContent("All Tests"));
}

@WithPlugins({"parallel-test-executor@1.6", "junit@1.3", "git@2.3"})
@WithPlugins({"workflow-aggregator@1.10", "parallel-test-executor@1.6", "junit@1.3", "git@2.3", "script-security@1.15"})
@Native("mvn")
@Test public void parallelTests() throws Exception {
for (int i = 0; i < 3; i++) {
Expand All @@ -116,8 +116,9 @@ public class WorkflowPluginTest extends AbstractJUnitTest {
WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
job.script.set(
"node('master') {\n" +
// TODO could be switched to multibranch, in which case this initial `node` is unnecessary, and each branch can just `checkout scm`
" git url: 'https://github.com/jenkinsci/parallel-test-executor-plugin-sample.git'\n" +
" archive 'pom.xml, src/'\n" +
" stash 'sources'\n" +
"}\n" +
"def splits = splitTests([$class: 'CountDrivenParallelism', size: 3])\n" +
"def branches = [:]\n" +
Expand All @@ -126,7 +127,7 @@ public class WorkflowPluginTest extends AbstractJUnitTest {
" branches[\"split${i}\"] = {\n" +
" node('!master') {\n" +
" sh 'rm -rf *'\n" +
" unarchive mapping: ['pom.xml' : '.', 'src/' : '.']\n" +
" unstash 'sources'\n" +
" writeFile file: 'exclusions.txt', text: exclusions.join(\"\\n\")\n" +
// Do not bother with ${tool 'M3'}; would take too long to unpack Maven on all slaves.
// TODO would be useful for ToolInstallation to support the URL installer, hosting the tool ZIP ourselves somewhere cached.
Expand All @@ -136,7 +137,7 @@ public class WorkflowPluginTest extends AbstractJUnitTest {
" }\n" +
"}\n" +
"parallel branches");
// TODO add "script-security@1.15" to @WithPlugins when released and: job.sandbox.check();
job.sandbox.check();
job.save();
Build build = job.startBuild();
try {
Expand Down

0 comments on commit 14b934c

Please sign in to comment.