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

MPL-32 Added working implementation of the JenkinsRule unit tests #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sparshev
Copy link
Collaborator

@sparshev sparshev commented Nov 6, 2019

TODO:

@sparshev
Copy link
Collaborator Author

sparshev commented Nov 7, 2019

Nope, we can't use CPS from JenkinsPipelineUnit by default - the implementation contains quite critical issues (for example [1,2,3].findAll { it > 1 } will return false instead of [2,3]), like the one was fixed here: jenkinsci/workflow-cps-plugin#124

@sparshev sparshev changed the title MPL-32 Moved to CPS tests by default MPL-32 Added a way to execute experimental CPS tests Nov 7, 2019
@sparshev sparshev changed the title MPL-32 Added a way to execute experimental CPS tests MPL-32 Added working implementation of the JenkinsRule unit tests Mar 5, 2020
@sparshev sparshev added the not tested The change is not properly tested label Mar 5, 2020
@sparshev
Copy link
Collaborator Author

sparshev commented Mar 5, 2020

Added another implementation of the CPS tests - based on JenkinsRule with groovy-cps interceptor. This implementation seems working fine mvn clean verify shows almost the same results as the simple JenkinsPipelineUnit tests. But:

  • Check with Jenkins devs - how to eliminate this java replacements, maybe they can help with some hooks for the unit tests...
  • Need to prepare a good documentation
  • Simplify migration from the old test base class MPLTestBase to the new one MPLTestBaseJenkinsRule
  • Prepare more tests as examples of usage this new tests
  • JenkinsRule instance produces logs I want to hide
  • Stack of MethodCall depth is not good - seems something wrong with CpsScript stacktrace (for example last Build.fileExists(openshift) is one level deeper than required... It could be some sort of issue with the Closure in the test).

@sparshev
Copy link
Collaborator Author

sparshev commented Mar 5, 2020

Reproduced weird behavior during tests running: when old tests running before new ones - new ones will not be completed:

Something in the groovy tests is not working well.

@sparshev
Copy link
Collaborator Author

sparshev commented Mar 5, 2020

Not weird as figured out - Helper.runModule replaced in the BuildTest, so it's saved for the future tests executions. Need to add restore the overriding classes state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request not tested The change is not properly tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant