cnp-jenkins-library icon indicating copy to clipboard operation
cnp-jenkins-library copied to clipboard

DTSPO-17456 Run tests for global functions

Open charlesluokb opened this issue 8 months ago • 0 comments

Previously all of the Jenkinsfile based tested were being silently skipped.

This happened when groovy was upgraded in a renovate test, in the groovy-all artifact there's a testing artifact, in version 2.5 this was switched from JUnit 4 to JUnit 5. There was no engine on the classpath for JUnit 4 tests and then these were silently being skipped.

These haven't been running for quite awhile so there's been a number of changes were additions haven't been made to the tests or syntax has been used that doesn't work in the pipeline library.

The most common problem was type information breaking the tests, a ClassCastException or a VerifyError would be thrown even though all the inputs matched what should be passed to the function or constructor.

The way to fix this was to drop the type information 😢

It might be possible to use a newer groovy and spock version e.g. see https://github.com/jenkinsci/JenkinsPipelineUnit/issues/499#issuecomment-1070816337. But its probably safer to leave it as 2.4 as that is what Jenkins is running on and someone might try and use a newer groovy feature than Jenkins supports

charlesluokb avatar Jun 17 '24 09:06 charlesluokb