# HG changeset patch # User Sergey Kandaurov # Date 1680554034 -14400 # Node ID cc13f7b098db1697d43f0cd07df54a58428710a7 # Parent 1023354f3a412ef897f66de119aabb0810739936 Tests: avoid premature stream reset in h3_limit_req.t. STREAM and RESET_STREAM frames could be batched, which prevents the stream from being processed and changes the status code. The fix is to wait for the stream acknowledgment. Here we just look at the largest acknowledged, this should be enough for simple cases. diff --git a/h3_limit_req.t b/h3_limit_req.t --- a/h3_limit_req.t +++ b/h3_limit_req.t @@ -138,6 +138,8 @@ is($frame->{headers}->{':status'}, 200, $s = Test::Nginx::HTTP3->new(); $sid = $s->new_stream({ path => '/', body_more => 1 }); +wait_ack($s); + $s->reset_stream($sid, 0x010c); $frames = $s->read(all => [{ type => 'DECODER_C' }]); @@ -150,6 +152,17 @@ like($t->read_file('test.log'), qr/499/, ############################################################################### +sub wait_ack { + my ($s) = @_; + my $last = $s->{pn}[0][3]; + + for (1 .. 5) { + my $frames = $s->read(all => [ {type => 'ACK' }]); + my ($frame) = grep { $_->{type} eq "ACK" } @$frames; + last unless $frame->{largest} < $last; + } +} + sub read_body_file { my ($path) = @_; return unless $path;