Open dclacher opened 2 years ago
For now, I've implemented a workaround described here: https://github.com/jenkinsci/JenkinsPipelineUnit/issues/230#issue-628265576
I had a similar problem where this was always the Testname@MemoryAdress and keeps changing. It helped me to set the following to false:
helper.cloneArgsOnMethodCallRegistration = false
My call stack changed from
easyreleaser.execute(EasyReleaserTest@3c54ddec, ....
to
easyreleaser.execute(Script-EasyReleaserTest,
Not sure if this is the correct way.
Hey guys and sorry if this has been asked before, but I couldn't quite find an answer for my problem.
I have a scripted pipeline in the
vars
folder calledpipelineJenkinsCI.groovy
that does the following while executing a step:cPlugin.notifyBitbucket(this, [commitSha1: scmVars.GIT_COMMIT])
Now,
cPlugin.groovy
is an implicit class (not declared with theclass
block, it contains only static methods) in thesrc
folder andnotifyBitbucket
is just a wrapper method for the original method of the Bitbucket plugin:The problem is that I'm passing the Jenkins context
this
as the first parameter (def ctx
) and when I create the callstack with the flag-Dpipeline.stack.write=true
, it records the context's address in memory as follows:But, of course, once I run the test again without the flag, it fails because a new context is created and the address will be different during the script execution, and the match will never happen.
My test class looks like that:
I've read in other issues about mocking the context (
this
) but I'm not sure that would be a solution nor how to achieve that. Any ideas? Anyone with a similar problem?Thank you.