-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Documented the RestartableJenkinsRule
#7754
base: master
Are you sure you want to change the base?
Documented the RestartableJenkinsRule
#7754
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @StefanSpieker for the PR! I have made some minor edit suggestions.
Co-authored-by: Kris Stern <[email protected]>
Thanks for the suggestions, @krisstern ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I like the documentation, but think that the heading should be changed from "Testing Durable Pipeline Steps" to "Testing Jenkins Restart", since the example is showing a test with a FreeStyleProject
rather than a Pipeline step.
I don't think we should use RestartableJenkinsRule
to test Pipeline steps because the workflow-durable-task-step
plugin is no longer using RestartableJenkinsRule
. It migrated from RestartableJenkinsRule
to JenkinsSessionRule
in this pull request:
It added RealJenkinsRule
based tests in these pull requests:
- [JENKINS-52165] Stabilize and better test
USE_WATCHING
jenkinsci/workflow-durable-task-step-plugin#323 - Build fails to resume if controller crashes before queue is saved jenkinsci/workflow-durable-task-step-plugin#408
I think that documenting RestartableJenkinsRule
is great. Thanks for doing it!
If you want to ensure that your plugin behaves correctly after a restart, there are methods to help you. | ||
`RestartableJenkinsRule` is part of the Jenkins testing framework and provides an easy way to simulate restarting Jenkins in your tests without actually having to restart the Jenkins instance. | ||
You can use the `then()` method to run one Jenkins session and then shut down. | ||
The following example shows how it can be used with a `FreeStyleJob` run which is verified after a Jenkins restart: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I lack fundamental skills in the use of RestartableJenkinsRule
, so I'm not a great reviewer of this pull request. My apologies in advance for mistakes that I may make in the review process.
Since the example uses a FreeStyleProject
, I think that the section heading should be changed from "Testing Durable Pipeline Steps" to "Testing Jenkins Restart". The example looks reasonable to me as a way to show that a FreeStyleProject
build status persisted across a restart.
I think the job type used in the test should be referenced using the phrase "Freestyle job", the phrase "Freestyle project", or the Java class name "FreeStyleProject
". The first two forms are used elsewhere in the www.jenkins.io documentation and the third is used in the example source code.
The following example shows how it can be used with a `FreeStyleJob` run which is verified after a Jenkins restart: | |
The following example shows how it can be used with a `FreeStyleProject` build which is verified after a Jenkins restart: |
Documented the
RestartableJenkinsRule
also created a very small example to showcase how it can be used.