Skip to content

Commit fc7c709

Browse files
Fix flaky test: test exception
DD_C2BAPS Co-authored-by: vandonr <[email protected]>
1 parent b09dcc5 commit fc7c709

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,11 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
11991199
response.code() == EXCEPTION.status
12001200
if (testExceptionBody()) {
12011201
assert response.body().string() == EXCEPTION.body
1202+
} else {
1203+
// Ensure the response stream is closed even when we don't assert the body, to avoid
1204+
// leaving the server-side request/response in an indeterminate state which can delay
1205+
// or prevent span emission in some servers/transports (e.g., HTTP/2).
1206+
response.body()?.close()
12021207
}
12031208

12041209
and:

0 commit comments

Comments
 (0)