Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTSPO-17456 Run tests for global functions #1242

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

charlesluokb
Copy link
Contributor

@charlesluokb charlesluokb commented Jun 17, 2024

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 jenkinsci/JenkinsPipelineUnit#499 (comment). 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

build.gradle Outdated Show resolved Hide resolved
@timja timja changed the title [WIP] Dtspo 17456 run tests for global funtions groovy 2.4.21 DTSPO-17456 Run tests for global functions Jun 18, 2024
}

compileGroovy {
groovyOptions.forkOptions.jvmArgs = [ '-Dgroovy.grape.enable=false' ]
// @CNP annotation comes from the Jenkins Runtime instance
exclude '**/pluginActive.groovy'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would fail somehow at the task compileGroovy

build.gradle Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants