comparison worker_shutdown_timeout_h2.t @ 1513:02412b209838

Tests: testing worker_shutdown_timeout works with HTTP/2. A request in HTTP/2 is ensured to be finalized with worker_shutdown_timeout by testing that it is logged at least, and the status code is not set as it would on proxy_read_timeout. After the fix has been fixed in ab5cac9d3f00, the latter can be tuned to a safer value without losing in execution time.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 23 Sep 2019 20:46:30 +0300
parents e84a3115bfe8
children ec8d3f623358
comparison
equal deleted inserted replaced
1512:e84a3115bfe8 1513:02412b209838
21 ############################################################################### 21 ###############################################################################
22 22
23 select STDERR; $| = 1; 23 select STDERR; $| = 1;
24 select STDOUT; $| = 1; 24 select STDOUT; $| = 1;
25 25
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(1); 26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(2);
27 27
28 $t->write_file_expand('nginx.conf', <<'EOF'); 28 $t->write_file_expand('nginx.conf', <<'EOF');
29 29
30 %%TEST_GLOBALS%% 30 %%TEST_GLOBALS%%
31 31
42 listen 127.0.0.1:8080 http2; 42 listen 127.0.0.1:8080 http2;
43 server_name localhost; 43 server_name localhost;
44 44
45 location / { 45 location / {
46 proxy_pass http://127.0.0.1:8081; 46 proxy_pass http://127.0.0.1:8081;
47 proxy_read_timeout 200ms; 47 proxy_read_timeout 5s;
48 } 48 }
49 } 49 }
50 } 50 }
51 EOF 51 EOF
52 52
58 my $s = Test::Nginx::HTTP2->new(); 58 my $s = Test::Nginx::HTTP2->new();
59 ok($s->new_stream(), 'new stream'); 59 ok($s->new_stream(), 'new stream');
60 60
61 select undef, undef, undef, 0.1; 61 select undef, undef, undef, 0.1;
62 $t->stop(); 62 $t->stop();
63
64 TODO: {
65 local $TODO = 'not yet' unless $t->has_version('1.17.4');
66
67 like($t->read_file('access.log'), qr/ (?!504)\d{3} /, 'shutdown timeout');
68
69 }
63 70
64 $t->todo_alerts() unless $t->has_version('1.17.4'); 71 $t->todo_alerts() unless $t->has_version('1.17.4');
65 72
66 ############################################################################### 73 ###############################################################################
67 74