Skip to content

Commit

Permalink
added test for script classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
daspilker committed Mar 12, 2016
1 parent 5dd153b commit 0f6e0ca
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,30 @@ class ExecuteDslScriptsSpec extends Specification {
freeStyleBuild.getLog(25).join('\n') =~ /jenkins.dsl/
}

def 'classpath per script'() {
setup:
FreeStyleProject job = jenkinsRule.createFreeStyleProject('seed')
job.scheduleBuild2(0).get() // run a build to create a workspace
job.someWorkspace.child('projectA/Utils.groovy').write('class Utils { static NAME = "projectA" }', 'UTF-8')
job.someWorkspace.child('projectA/script.groovy').write('job(Utils.NAME)', 'UTF-8')
job.someWorkspace.child('projectB/Utils.groovy').write('class Utils { static NAME = "projectB" }', 'UTF-8')
job.someWorkspace.child('projectB/script.groovy').write('job(Utils.NAME)', 'UTF-8')
job.buildersList.add(new ExecuteDslScripts(
new ExecuteDslScripts.ScriptLocation('false', 'projectA/script.groovy\nprojectB/script.groovy', null),
true,
RemovedJobAction.IGNORE
))
job.onCreatedFromScratch()

when:
FreeStyleBuild freeStyleBuild = job.scheduleBuild2(0).get()

then:
freeStyleBuild.result == SUCCESS
jenkinsRule.jenkins.getItem('projectA') != null
jenkinsRule.jenkins.getItem('projectB') != null
}

private static final String SCRIPT = """job('test-job') {
}"""

Expand Down

0 comments on commit 0f6e0ca

Please sign in to comment.