Mercurial > hg > nginx-tests
comparison h2.t @ 990:eb49d29d5447
Tests: redo 892737e9fd31 without flaky send_timeout adjustments.
The GOAWAY tests were moved closer to server shutdown
to not step over an unrelated test delay.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 21 Jul 2016 14:43:46 +0300 |
parents | 892737e9fd31 |
children | 35739834ecd9 |
comparison
equal
deleted
inserted
replaced
989:98546e08521f | 990:eb49d29d5447 |
---|---|
133 | 133 |
134 server { | 134 server { |
135 listen 127.0.0.1:8086 http2; | 135 listen 127.0.0.1:8086 http2; |
136 server_name localhost; | 136 server_name localhost; |
137 | 137 |
138 send_timeout 2s; | 138 send_timeout 1s; |
139 } | 139 } |
140 | 140 |
141 server { | 141 server { |
142 listen 127.0.0.1:8087 http2; | 142 listen 127.0.0.1:8087 http2; |
143 server_name localhost; | 143 server_name localhost; |
832 $s = Test::Nginx::HTTP2->new(port(8086)); | 832 $s = Test::Nginx::HTTP2->new(port(8086)); |
833 $sid = $s->new_stream({ path => '/tbig.html' }); | 833 $sid = $s->new_stream({ path => '/tbig.html' }); |
834 $s->h2_window(2**30, $sid); | 834 $s->h2_window(2**30, $sid); |
835 $s->h2_window(2**30); | 835 $s->h2_window(2**30); |
836 | 836 |
837 select undef, undef, undef, 2.5; | 837 select undef, undef, undef, 2.1; |
838 | 838 |
839 $s->h2_ping('SEE-THIS'); | 839 $s->h2_ping('SEE-THIS'); |
840 | 840 |
841 $frames = $s->read(all => [{ type => 'PING' }]); | 841 $frames = $s->read(all => [{ type => 'PING' }]); |
842 ok(!grep ({ $_->{type} eq "PING" } @$frames), 'large response - send timeout'); | 842 ok(!grep ({ $_->{type} eq "PING" } @$frames), 'large response - send timeout'); |
1064 $frames = $s->read(all => [{ type => 'PING' }]); | 1064 $frames = $s->read(all => [{ type => 'PING' }]); |
1065 | 1065 |
1066 ($frame) = grep { $_->{type} eq "PING" } @$frames; | 1066 ($frame) = grep { $_->{type} eq "PING" } @$frames; |
1067 is($frame->{value}, 'SEE-THIS', 'unknown frame type'); | 1067 is($frame->{value}, 'SEE-THIS', 'unknown frame type'); |
1068 | 1068 |
1069 # GOAWAY - force closing a connection by server with idle or active streams | |
1070 | |
1071 $sid = $s->new_stream(); | |
1072 $s->read(all => [{ sid => $sid, fin => 1 }]); | |
1073 | |
1074 my $active = Test::Nginx::HTTP2->new(port(8086)); | |
1075 $active->new_stream({ path => '/tbig.html' }); | |
1076 | |
1077 # graceful shutdown with stream waiting on HEADERS payload | 1069 # graceful shutdown with stream waiting on HEADERS payload |
1078 | 1070 |
1079 my $grace = Test::Nginx::HTTP2->new(port(8084)); | 1071 my $grace = Test::Nginx::HTTP2->new(port(8084)); |
1080 $grace->new_stream({ split => [ 9 ], abort => 1 }); | 1072 $grace->new_stream({ split => [ 9 ], abort => 1 }); |
1081 | 1073 |
1097 $sid = $grace4->new_stream({ path => '/proxy/t2.html', body_more => 1 }); | 1089 $sid = $grace4->new_stream({ path => '/proxy/t2.html', body_more => 1 }); |
1098 $grace4->h2_body('TEST', { split => [ 12 ], abort => 1 }); | 1090 $grace4->h2_body('TEST', { split => [ 12 ], abort => 1 }); |
1099 | 1091 |
1100 select undef, undef, undef, 1.1; | 1092 select undef, undef, undef, 1.1; |
1101 undef $grace4; | 1093 undef $grace4; |
1094 | |
1095 # GOAWAY - force closing a connection by server with idle or active streams | |
1096 | |
1097 $sid = $s->new_stream(); | |
1098 $s->read(all => [{ sid => $sid, fin => 1 }]); | |
1099 | |
1100 my $active = Test::Nginx::HTTP2->new(port(8086)); | |
1101 $active->new_stream({ path => '/tbig.html' }); | |
1102 | 1102 |
1103 $t->stop(); | 1103 $t->stop(); |
1104 | 1104 |
1105 $frames = $s->read(all => [{ type => 'GOAWAY' }]); | 1105 $frames = $s->read(all => [{ type => 'GOAWAY' }]); |
1106 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; | 1106 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames; |