Make a test result intentionally unstable

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Make a test result intentionally unstable

Christoph Fetzer
Hello!

I have a unit test that from time to time deadlocks. To work around that and at least finish the build and collect the results available so far I made use of a timeout in a try and caught the timeout. When this timeout applies now, I get an overall green testrun which is not what I want. When I want so set the test result to 'unstable' either by calling 'unstable' or by setting the result to the string 'UNSTABLE' I still get a succeeded run.

This is my script code, called from a declarative pipeline from the build stages of severak modules/libraries in a build:

try{                                        
    timeout
(time: 60, unit: 'MINUTES') {                
        bat
"""                
            rem call my test from here
            """

   
}
} catch (err) {
    echo
"Caught: ${err}"
   
//currentBuild.result = 'UNSTABLE';
    unstable
( message: "Test timeout in stage ${STAGE_NAME}" )
}

Any ideas whats wrong here?
Regards,
Christoph

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1010ffee-b381-40c0-8c4f-2c8bb29e05cc%40googlegroups.com.