Skip to content

Commit

Permalink
Add test for maximum_concurrent_streams setting change.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Nov 9, 2024
1 parent 1c870bc commit 27191f0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/protocol/http2/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,44 @@ def before
expect(frame).to be(:acknowledgement?)
end

it "can update concurrent streams" do
initial_maximum_concurrent_streams = server.maximum_concurrent_streams
inform "Initial maximum concurrent streams: #{initial_maximum_concurrent_streams}"

server.send_settings([
[Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS, 1]
])

# It's not acknowledged until the client sends an acknowledgement:
expect(server).to have_attributes(
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
)

expect(client).to have_attributes(
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
)

frame = client.read_frame
expect(frame).to be_a(Protocol::HTTP2::SettingsFrame)

expect(client).to have_attributes(
maximum_concurrent_streams: be == 1
)

frame = server.read_frame
expect(frame).to be_a(Protocol::HTTP2::SettingsFrame)
expect(frame).to be(:acknowledgement?)

expect(server.local_settings).to have_attributes(
maximum_concurrent_streams: be == 1
)

# The client maximum concurrent streams was not changed because the client did not `send_settings`:
expect(server).to have_attributes(
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
)
end

it "doesn't accept headers for an existing stream" do
stream.send_headers(nil, request_headers)
expect(stream.id).to be == 1
Expand Down

0 comments on commit 27191f0

Please sign in to comment.