Don't listen 0.0.0.0 in tests (DataDog/dd-trace-java#1434)
MODIFY
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackAsyncHttpServerTest.groovy
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackAsyncHttpServerTest.groovy
@@ -33,6 +33,7 @@ class RatpackAsyncHttpServerTest extends RatpackHttpServerTest {
def ratpack = GroovyEmbeddedApp.ratpack {
serverConfig {
port bindPort
+ address InetAddress.getByName('localhost')
}
bindings {
bind TestErrorHandler
@@ -109,6 +110,7 @@ class RatpackAsyncHttpServerTest extends RatpackHttpServerTest {
ratpack.server.start()
assert ratpack.address.port == bindPort
+ assert ratpack.server.bindHost == 'localhost'
return ratpack
}
}

MODIFY
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackForkedHttpServerTest.groovy
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackForkedHttpServerTest.groovy
@@ -33,6 +33,7 @@ class RatpackForkedHttpServerTest extends RatpackHttpServerTest {
def ratpack = GroovyEmbeddedApp.ratpack {
serverConfig {
port bindPort
+ address InetAddress.getByName('localhost')
}
bindings {
bind TestErrorHandler

MODIFY
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackHttpServerTest.groovy
instrumentation/ratpack-1.5/src/test/groovy/server/RatpackHttpServerTest.groovy
@@ -41,6 +41,7 @@ class RatpackHttpServerTest extends HttpServerTest<EmbeddedApp> {
def ratpack = GroovyEmbeddedApp.ratpack {
serverConfig {
port bindPort
+ address InetAddress.getByName('localhost')
}
bindings {
bind TestErrorHandler

MODIFY
instrumentation/servlet/request-2.3/src/test/groovy/JettyServlet2Test.groovy
instrumentation/servlet/request-2.3/src/test/groovy/JettyServlet2Test.groovy
@@ -38,7 +38,9 @@ class JettyServlet2Test extends HttpServerTest<Server> {
@Override
Server startServer(int port) {
def jettyServer = new Server(port)
- jettyServer.connectors.each { it.resolveNames = true } // get localhost instead of 127.0.0.1
+ jettyServer.connectors.each {
+ it.setHost('localhost')
+ }
ServletContextHandler servletContext = new ServletContextHandler(null, "/$CONTEXT")
servletContext.errorHandler = new ErrorHandler() {
protected void handleErrorPage(HttpServletRequest request, Writer writer, int code, String message) throws IOException {

MODIFY
instrumentation/servlet/request-3.0/src/test/groovy/JettyServlet3Test.groovy
instrumentation/servlet/request-3.0/src/test/groovy/JettyServlet3Test.groovy
@@ -38,9 +38,7 @@ abstract class JettyServlet3Test extends AbstractServlet3Test<Server, ServletCon
Server startServer(int port) {
def jettyServer = new Server(port)
jettyServer.connectors.each {
- if (it.hasProperty("resolveNames")) {
- it.resolveNames = true // get localhost instead of 127.0.0.1
- }
+ it.setHost('localhost')
}
ServletContextHandler servletContext = new ServletContextHandler(null, "/$context")

MODIFY
testing/src/main/groovy/io/opentelemetry/auto/test/server/http/TestHttpServer.groovy
testing/src/main/groovy/io/opentelemetry/auto/test/server/http/TestHttpServer.groovy
@@ -61,6 +61,9 @@ class TestHttpServer implements AutoCloseable {
private TestHttpServer() {
internalServer = new Server(0)
+ internalServer.connectors.each {
+ it.setHost('localhost')
+ }
}
def start() {

Don't listen 0.0.0.0 in tests (DataDog/dd-trace-java#1434)