diff --git a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy index 0b2a28d954b..ac7e2fd17b7 100644 --- a/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy +++ b/dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy @@ -1170,6 +1170,7 @@ abstract class HttpServerTest extends WithHttpServer { } response.body().contentLength() < 1 || redirectHasBody() + response.close() and: assertTraces(1) { @@ -1210,6 +1211,8 @@ abstract class HttpServerTest extends WithHttpServer { if (bubblesResponse()) { assert response.body().string().contains(ERROR.body) assert response.code() == ERROR.status + } else { + response.close() } and: @@ -1255,6 +1258,8 @@ abstract class HttpServerTest extends WithHttpServer { response.code() == EXCEPTION.status if (testExceptionBody()) { assert response.body().string() == EXCEPTION.body + } else { + response.close() } and: @@ -1299,6 +1304,7 @@ abstract class HttpServerTest extends WithHttpServer { expect: response.code() == NOT_FOUND.status + response.close() and: assertTraces(1) { @@ -1836,6 +1842,7 @@ abstract class HttpServerTest extends WithHttpServer { response.code() == 301 response.header('location') == 'https://www.google.com/' !handlerRan + response.close() when: TEST_WRITER.waitForTraces(1) @@ -2117,6 +2124,7 @@ abstract class HttpServerTest extends WithHttpServer { } response.code() == 301 response.header("Location") == 'https://www.google.com/' + response.close() TEST_WRITER.waitForTraces(1) def trace = TEST_WRITER.get(0)