ExpediaGroup / jenkins-spock

Unit-test Jenkins pipeline code with Spock
https://javadoc.io/doc/com.homeaway.devtools.jenkins/jenkins-spock
Apache License 2.0
187 stars 76 forks source link

Keep the behaviour of unstable calls #107

Open pgbastante opened 3 years ago

pgbastante commented 3 years ago

Desired Behavior

unstable jenkins call is being mocked by jenkins-spock (as it is supposed to) but by doing this the currentBuild.status/currentBuild.result variable is not updated when unstable is called so any pipeline script that depends on this mechanism will not be able to check if the script worked or not. In my case, I catch all exceptions so the noExceptionThrown() for the then block is not enougth.

The request is to provide a way to keep the behaviour of unstable or at least keep the update of theese variables

Benefits

As I mentioned, allow the update of the currentBuild.status/currentBuild.result variables during test and check them to assert the correct execution of the test

Hope you can help. Thank you!