Skip to content

Commit 1677743

Browse files
committed
test(http2): cover stream cancellation errors
Make reset and connection-close error mapping deterministic. This removes coverage dependence on cancellation race timing.
1 parent e34b181 commit 1677743

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/http2_server_tests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ function _drain_h2_server_responses!(conn::NC.Conn, reader::IO, decoder::HT.Deco
195195
return Dict(id => String(bodies[id]) for id in expected)
196196
end
197197

198+
@testset "HTTP/2 server stream cancellation errors" begin
199+
reset_error = HT._h2_server_stream_exception(HT._H2_SERVER_STREAM_RESET)
200+
closed_error = HT._h2_server_stream_exception(HT._H2_SERVER_STREAM_CONN_CLOSED)
201+
@test reset_error.message == "HTTP/2 stream reset by peer"
202+
@test closed_error.message == "HTTP/2 connection is closed"
203+
end
204+
198205
@testset "HTTP/2 server request handling" begin
199206
server = HT.serve!("127.0.0.1", 0; listenany = true) do request
200207
payload = collect(codeunits("h2:" * request.target))

0 commit comments

Comments
 (0)