-
Notifications
You must be signed in to change notification settings - Fork 395
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
Can't mock up sh when called from class method #451
Comments
You are calling |
Sorry, I was a bit sleepy and missed that I'm calling the sh with options. I updated the |
I added an reproducible example here: https://github.com/joanayma/jenkinsPipelineUnit-issue-451 and updated issue description. |
@nre-ableton any idea what to do? Should I implement something different in the above class? |
@joanayma If you could make a PR which had a failing test case, that would be really convenient. Then I could take the PR and find the source of the problem more easily, since I could more easily debug it with the framework. The repo you created is nice, but I haven't had time to get around to forking it and playing around with it. |
I have the same issue. Consider this scenario:
The code for classes is below:
As you can see above, ClassA is loaded using "new" statement and not "load" statement. |
I was able to work around this issue by adding this code to setUp() in the test class.
|
I'm testing a library (var/test.groovy) that uses a class (src/foo/MyClass.groovy) using a Jenkinsfile (resources/Jenkinsfile) loaded in test (tests/PipelineTest.groovy) (I simplified the example). I'm having issues passing the
script
block to a method of the class.Issue example: https://github.com/joanayma/jenkinsPipelineUnit-issue-451
the error is:
I've been using this passing script object to class method several times and works fine in Jenkins. Actually
script.docker
mocks up docker just fine. I also tried to mock up the 'sh' command as shown but no luck.Should I implement this in a different way? How can I mock up a method when it's on the StageDeclaration? Thanks.
The text was updated successfully, but these errors were encountered: