Hi,
we are currently trying to migrate to job-dsl-core 1.40, but get stuck while updating our tests due to the changes for JENKINS-30348.
Here is one example of what we do
@Shared List<File> jobDslFiles = JobHelper.getAllJobDslFiles()
final JobManagement jm = JobHelper.createJobParent().getJm()
def 'test basics for #script'() {
setup:
URL scriptURL = new File(script.getPath()).toURI().toURL()
ScriptRequest scriptRequest = new ScriptRequest(script.name, null, scriptURL)
expect:
DslScriptLoader.runDslEngineForParent(scriptRequest, jm).getReferencedJobs().each { Job job ->
with(job.node) {
!logRotator.text().isEmpty()
!description.text().isEmpty()
}
}
where:
script << jobDslFiles
}
Basically we check specific config nodes to be existent or to have the right configruation value. How can we keep this up using
DslScriptLoader.runDslEngine(scriptRequest, jm)?
One thing I realized is that we could switch the JobManagement (we use new FileJobManagement(new File("target/generated-configs"))) to MemoryJobManagement in order to get access to the savedConfigs but then we would have to parse it back to xml first. That doesn't seem to be the right approach, or am I wrong?