Skip to content

Commit 322715f

Browse files
Fix flaky test exception by closing response in HttpServerTest
DD_C0320J Co-authored-by: janhavis <janhavi.sahasrabuddhe@gmail.com>
1 parent f8076be commit 322715f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

dd-java-agent/instrumentation-testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,8 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12101210
if (bubblesResponse()) {
12111211
assert response.body().string().contains(ERROR.body)
12121212
assert response.code() == ERROR.status
1213+
} else {
1214+
response.close()
12131215
}
12141216

12151217
and:
@@ -1239,7 +1241,6 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12391241
}
12401242
}
12411243

1242-
@Flaky(value = "https://github.com/DataDog/dd-trace-java/issues/9396", suites = ["PekkoHttpServerInstrumentationAsyncHttp2Test"])
12431244
def "test exception"() {
12441245
setup:
12451246
def method = "GET"
@@ -1255,6 +1256,8 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12551256
response.code() == EXCEPTION.status
12561257
if (testExceptionBody()) {
12571258
assert response.body().string() == EXCEPTION.body
1259+
} else {
1260+
response.close()
12581261
}
12591262

12601263
and:
@@ -1299,6 +1302,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
12991302

13001303
expect:
13011304
response.code() == NOT_FOUND.status
1305+
response.close()
13021306

13031307
and:
13041308
assertTraces(1) {

0 commit comments

Comments
 (0)