Mercurial > hg > nginx-tests
comparison h2.t @ 945:d73bef563aea
Tests: speed up HTTP/2 tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 15 Jun 2016 13:27:56 +0300 |
parents | 235f796c2861 |
children | 4dc302d8e04f |
comparison
equal
deleted
inserted
replaced
944:235f796c2861 | 945:d73bef563aea |
---|---|
224 is($frame->{flags}, 1, 'PING flags ack'); | 224 is($frame->{flags}, 1, 'PING flags ack'); |
225 is($frame->{sid}, 0, 'PING stream'); | 225 is($frame->{sid}, 0, 'PING stream'); |
226 | 226 |
227 # timeouts | 227 # timeouts |
228 | 228 |
229 SKIP: { | |
230 skip 'long tests', 6 unless $ENV{TEST_NGINX_UNSAFE}; | |
231 | |
229 push my @sess, new_session(8089, pure => 1); | 232 push my @sess, new_session(8089, pure => 1); |
230 push @sess, new_session(8089, pure => 1); | 233 push @sess, new_session(8089, pure => 1); |
231 h2_ping($sess[-1], 'SEE-THIS'); | 234 h2_ping($sess[-1], 'SEE-THIS'); |
232 push @sess, new_session(8090, pure => 1); | 235 push @sess, new_session(8090, pure => 1); |
233 push @sess, new_session(8090, pure => 1); | 236 push @sess, new_session(8090, pure => 1); |
251 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]); | 254 $frames = h2_read(shift @sess, all => [{ type => "GOAWAY" }]); |
252 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 255 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
253 ok($frame, 'idle timeout - idle connection GOAWAY'); | 256 ok($frame, 'idle timeout - idle connection GOAWAY'); |
254 is($frame->{code}, 0, 'idle timeout - idle connection code'); | 257 is($frame->{code}, 0, 'idle timeout - idle connection code'); |
255 | 258 |
259 } | |
260 | |
256 # GOAWAY | 261 # GOAWAY |
257 | 262 |
258 h2_goaway(new_session(), 0, 0, 5); | 263 h2_goaway(new_session(), 0, 0, 5); |
259 h2_goaway(new_session(), 0, 0, 5, 'foobar'); | 264 h2_goaway(new_session(), 0, 0, 5, 'foobar'); |
260 h2_goaway(new_session(), 0, 0, 5, 'foobar', split => [ 8, 8, 4 ]); | 265 h2_goaway(new_session(), 0, 0, 5, 'foobar', split => [ 8, 8, 4 ]); |
278 TODO: { | 283 TODO: { |
279 local $TODO = 'not yet'; | 284 local $TODO = 'not yet'; |
280 | 285 |
281 $sess = new_session(); | 286 $sess = new_session(); |
282 h2_goaway($sess, 1, 0, 5, 'foobar'); | 287 h2_goaway($sess, 1, 0, 5, 'foobar'); |
283 $frames = h2_read($sess, all => [{ type => "GOAWAY" }]); | 288 $frames = h2_read($sess, all => [{ type => "GOAWAY" }], wait => 0.5); |
284 | 289 |
285 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 290 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |
286 ok($frame, 'GOAWAY invalid stream - GOAWAY frame'); | 291 ok($frame, 'GOAWAY invalid stream - GOAWAY frame'); |
287 is($frame->{code}, 1, 'GOAWAY invalid stream - GOAWAY PROTOCOL_ERROR'); | 292 is($frame->{code}, 1, 'GOAWAY invalid stream - GOAWAY PROTOCOL_ERROR'); |
288 | 293 |
704 | 709 |
705 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; | 710 ($frame) = grep { $_->{type} eq "PING" && $_->{flags} & 0x1 } @$frames; |
706 ok($frame, 'iws - PING not blocked'); | 711 ok($frame, 'iws - PING not blocked'); |
707 | 712 |
708 h2_window($sess, 2**16, $sid); | 713 h2_window($sess, 2**16, $sid); |
709 $frames = h2_read($sess); | 714 $frames = h2_read($sess, wait => 0.2); |
710 is(@$frames, 0, 'iws - updated stream window'); | 715 is(@$frames, 0, 'iws - updated stream window'); |
711 | 716 |
712 h2_window($sess, 2**16); | 717 h2_window($sess, 2**16); |
713 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 718 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
714 | 719 |
763 | 768 |
764 # predefined window size, minus new iws settings, minus window update | 769 # predefined window size, minus new iws settings, minus window update |
765 | 770 |
766 h2_window($sess, 2**16 - 1 - 42 - 1024, $sid); | 771 h2_window($sess, 2**16 - 1 - 42 - 1024, $sid); |
767 | 772 |
768 $frames = h2_read($sess); | 773 $frames = h2_read($sess, wait => 0.2); |
769 is(@$frames, 0, 'zero window - no data'); | 774 is(@$frames, 0, 'zero window - no data'); |
770 | 775 |
771 h2_window($sess, 1, $sid); | 776 h2_window($sess, 1, $sid); |
772 | 777 |
773 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]); | 778 $frames = h2_read($sess, all => [{ sid => $sid, length => 1 }]); |
845 h2_window($sess, 2**30); | 850 h2_window($sess, 2**30); |
846 | 851 |
847 select undef, undef, undef, 0.4; | 852 select undef, undef, undef, 0.4; |
848 | 853 |
849 h2_rst($sess, $sid, 8); | 854 h2_rst($sess, $sid, 8); |
850 h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 855 h2_read($sess, all => [{ sid => $sid, fin => 1 }], wait => 0.2); |
851 | 856 |
852 $sid = new_stream($sess); | 857 $sid = new_stream($sess); |
853 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); | 858 $frames = h2_read($sess, all => [{ sid => $sid, fin => 1 }]); |
854 | 859 |
855 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; | 860 ($frame) = grep { $_->{type} eq "HEADERS" } @$frames; |