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

[RealJenkinsRule] Switching hardcoded IPv4 address to loopback address #712

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

PereBueno
Copy link
Contributor

@PereBueno PereBueno commented Jan 11, 2024

As described in #711.

This change removes the hardcoded 127.0.0.1 address used in RealJenkinsRule and replaces it with the real loopback address, so it will use the IPv4 loopback address, 127.0.0.1, or the IPv6 loopback address, ::1 (in long format, so 0:0:0:0:0:0:0:1).

Regardless address can be overriden via withHttpListenAddress it makes sense to have default address use the right protocol so that method is used only for specific cases.

This change won't affect any test using getUrl() method, as that method returns an URL pointing to localhost so should be version-agnostic.

Testing done

Check running tests using snapshot:
With IPv6

mvn clean test -Djava.net.preferIPv6Addresses=true -Dtest=[......]
...
JENKINS_HOME=[..] SUREFIRE_FORK_NUMBER=1 java -DRealJenkinsRule.location=file:[PATH]/.m2/repository/org/jenkins-ci/main/jenkins-test-harness/999999-SNAPSHOT/jenkins-test-harness-999999-SNAPSHOT.jar [...] --httpPort=0 --httpListenAddress=0:0:0:0:0:0:0:1 --prefix=/jenkins

With IPv4

mvn clean test -Djava.net.preferIPv6Addresses=false -Dtest=[......]
...
JENKINS_HOME=[..] SUREFIRE_FORK_NUMBER=1 java -DRealJenkinsRule.location=file:[PATH]/.m2/repository/org/jenkins-ci/main/jenkins-test-harness/999999-SNAPSHOT/jenkins-test-harness-999999-SNAPSHOT.jar [...] --httpPort=0 --httpListenAddress=127.0.0.1 --prefix=/jenkins

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
    Options
  2. Ensure that the pull request title represents the desired changelog entry
    Options
  3. Please describe what you did
    Options
  4. Link to relevant issues in GitHub or Jira
    Options
  5. Link to relevant pull requests, esp. upstream and downstream changes
    Options
  6. Ensure you have provided tests - that demonstrates feature works or fixes the issue
    Options

@MarkEWaite MarkEWaite merged commit 8048252 into jenkinsci:master Jan 11, 2024
14 checks passed
@jglick jglick added bug and removed developer labels Jan 17, 2024
@jglick jglick mentioned this pull request Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants