comparison h2.t @ 1648:48d8c16d48ea

Tests: HTTP/2 connection timeout tests removed. Both http2_recv_timeout and http2_idle_timeout are scheduled for removal.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 09 Feb 2021 10:51:56 +0300
parents 35beaf85de72
children 20e0ec3b4dec
comparison
equal deleted inserted replaced
1647:35beaf85de72 1648:48d8c16d48ea
24 24
25 select STDERR; $| = 1; 25 select STDERR; $| = 1;
26 select STDOUT; $| = 1; 26 select STDOUT; $| = 1;
27 27
28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/) 28 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy rewrite charset gzip/)
29 ->plan(150); 29 ->plan(144);
30 30
31 $t->write_file_expand('nginx.conf', <<'EOF'); 31 $t->write_file_expand('nginx.conf', <<'EOF');
32 32
33 %%TEST_GLOBALS%% 33 %%TEST_GLOBALS%%
34 34
108 108
109 server { 109 server {
110 listen 127.0.0.1:8084 http2; 110 listen 127.0.0.1:8084 http2;
111 server_name localhost; 111 server_name localhost;
112 112
113 http2_recv_timeout 1s;
114 client_header_timeout 1s; 113 client_header_timeout 1s;
115 send_timeout 1s; 114 send_timeout 1s;
116 } 115 }
117 116
118 server { 117 server {
119 listen 127.0.0.1:8085 http2; 118 listen 127.0.0.1:8085 http2;
120 server_name localhost; 119 server_name localhost;
121 120
122 http2_idle_timeout 1s;
123 client_body_timeout 1s; 121 client_body_timeout 1s;
124 122
125 location /proxy2/ { 123 location /proxy2/ {
126 add_header X-Body $request_body; 124 add_header X-Body $request_body;
127 proxy_pass http://127.0.0.1:8081/; 125 proxy_pass http://127.0.0.1:8081/;
241 ($frame) = grep { $_->{type} eq "PING" } @$frames; 239 ($frame) = grep { $_->{type} eq "PING" } @$frames;
242 ok($frame, 'PING frame'); 240 ok($frame, 'PING frame');
243 is($frame->{value}, 'SEE-THIS', 'PING payload'); 241 is($frame->{value}, 'SEE-THIS', 'PING payload');
244 is($frame->{flags}, 1, 'PING flags ack'); 242 is($frame->{flags}, 1, 'PING flags ack');
245 is($frame->{sid}, 0, 'PING stream'); 243 is($frame->{sid}, 0, 'PING stream');
246
247 # timeouts
248
249 SKIP: {
250 skip 'long tests', 6 unless $ENV{TEST_NGINX_UNSAFE};
251
252 push my @s, Test::Nginx::HTTP2->new(port(8084), pure => 1);
253 push @s, Test::Nginx::HTTP2->new(port(8084), pure => 1);
254 $s[-1]->h2_ping('SEE-THIS');
255 push @s, Test::Nginx::HTTP2->new(port(8085), pure => 1);
256 push @s, Test::Nginx::HTTP2->new(port(8085), pure => 1);
257 $s[-1]->h2_ping('SEE-THIS');
258
259 select undef, undef, undef, 2.1;
260
261 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]);
262 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
263 ok($frame, 'recv timeout - new connection GOAWAY');
264 is($frame->{code}, 1, 'recv timeout - new connection code');
265
266 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]);
267 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
268 is($frame, undef, 'recv timeout - idle connection GOAWAY');
269
270 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]);
271 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
272 is($frame, undef, 'idle timeout - new connection GOAWAY');
273
274 $frames = (shift @s)->read(all => [{ type => "GOAWAY" }]);
275 ($frame) = grep { $_->{type} eq "GOAWAY" } @$frames;
276 ok($frame, 'idle timeout - idle connection GOAWAY');
277 is($frame->{code}, 0, 'idle timeout - idle connection code');
278
279 }
280 244
281 # GOAWAY 245 # GOAWAY
282 246
283 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5); 247 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5);
284 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5, 'foobar'); 248 Test::Nginx::HTTP2->new()->h2_goaway(0, 0, 5, 'foobar');