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
Ensure RealJenkinsRule
tests always start on a free port
#348
Ensure RealJenkinsRule
tests always start on a free port
#348
Conversation
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
Do we even need jenkinsci/winstone#174? Just pass Mentioned previously in #347 (comment). That discussion diverged into whether There was also a discussion of |
Correct, for RJR we could probably take the route you propose to avoid waiting for the next LTS. |
I tried to prototype that but hit a wall—there is no apparent way from inside Jenkins code to tell which port Jetty started on, without having a
but that does not seem reliable. |
RealJenkinsRule
tests always start on a free port
I will lift draft state as soon as Jenkins 2.346 LTS is out. |
#348 (comment) again. Is it feasible to make this work when on newer Jenkins versions but fall back to the previous behavior? Otherwise rollout will be a headache since Dependabot POM updates will break nearly every plugin. |
I can probably adapt some of what I've done for the ath... |
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.
Looks right.
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.
Ready for release?
Amends jenkinsci#348, as it broke semantic of #getUrl which now must be called after starting Jenkins.
Since jenkinsci/jenkins-test-harness#475 & jenkinsci/jenkins-test-harness#348, you need to call RealJenkinsRule#getUrl after starting Jenkins.
Since jenkinsci/jenkins-test-harness#475 & jenkinsci/jenkins-test-harness#348, you need to call RealJenkinsRule#getUrl after starting Jenkins.
RealJenkinsRule
tests running in parallel or involving multiple Jenkins instances have been flaky because the "random" port allocation can lead to attempts to use ports which are in fact already used.This work relies on jenkinsci/winstone#174 to ensure the Jenkins instance started by
RealJenkinsRule
starts on a random free port (allocated by winstone/jetty). Subsequent restarts (if there are) will reuse the same port to ensure Jenkins URL stability.