forked from Accenture/adop-cartridge-doa-m3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobScriptsSpec.groovy
40 lines (33 loc) · 1013 Bytes
/
JobScriptsSpec.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.java.cartridge
import groovy.io.FileType
import javaposse.jobdsl.dsl.DslScriptLoader
import javaposse.jobdsl.dsl.MemoryJobManagement
import spock.lang.Specification
import spock.lang.Unroll
/**
* Tests that all dsl scripts in the jobs directory will compile.
*/
class JobScriptsSpec extends Specification {
@Unroll
void 'test script #file.name should compile'(File file) {
given:
MemoryJobManagement jm = new MemoryJobManagement()
jm.parameters << [
WORKSPACE_NAME: 'ExampleWorkspace',
PROJECT_NAME : 'ExampleProject',
]
when:
DslScriptLoader.runDslEngine(file.text, jm)
then:
noExceptionThrown()
where:
file << jobFiles
}
static List<File> getJobFiles() {
List<File> files = []
new File('jenkins/jobs/dsl').eachFileRecurse(FileType.FILES) {
if (it =~ /.*?\.groovy/) files << it
}
files
}
}