Mercurial > hg > nginx-tests
annotate worker_shutdown_timeout_h2.t @ 1988:b5c1c3ef2345
Tests: adjusted sub_filter_multi.t limit rate settings.
With previous settings some tests with short buffers, which are under
TEST_NGINX_UNSAFE, used to hit 8 seconds timeout in http_get(), leading
to test failures.
Reported by Hiroaki Nakamura,
https://freenginx.org/pipermail/nginx-devel/2024-June/000373.html
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 20 Jun 2024 21:12:00 +0300 |
parents | 11463d379570 |
children |
rev | line source |
---|---|
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for worker_shutdown_timeout and HTTP/2 with proxy. |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use Test::Nginx::HTTP2; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
1513
02412b209838
Tests: testing worker_shutdown_timeout works with HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1512
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(2); |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 $t->write_file_expand('nginx.conf', <<'EOF'); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 daemon off; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 worker_shutdown_timeout 10ms; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 events { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 http { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 %%TEST_GLOBALS_HTTP%% |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server { |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
42 listen 127.0.0.1:8080; |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server_name localhost; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
1986
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
45 http2 on; |
11463d379570
Tests: reworked HTTP/2 tests to use "http2 on".
Maxim Dounin <mdounin@mdounin.ru>
parents:
1900
diff
changeset
|
46 |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 location / { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 proxy_pass http://127.0.0.1:8081; |
1513
02412b209838
Tests: testing worker_shutdown_timeout works with HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1512
diff
changeset
|
49 proxy_read_timeout 5s; |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 EOF |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 $t->run_daemon(\&http_silent_daemon); |
1900
236d038dc04a
Tests: suppress "listen .. http2;" deprecation warnings.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
56 $t->run(); |
236d038dc04a
Tests: suppress "listen .. http2;" deprecation warnings.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1693
diff
changeset
|
57 $t->waitforsocket('127.0.0.1:' . port(8081)); |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 my $s = Test::Nginx::HTTP2->new(); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 ok($s->new_stream(), 'new stream'); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
1518
fca71a8ebf6d
Tests: adjusted worker_shutdown_timeout_h2.t shutdown delay more.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1517
diff
changeset
|
64 $s->h2_ping('SEE-THIS'); |
fca71a8ebf6d
Tests: adjusted worker_shutdown_timeout_h2.t shutdown delay more.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1517
diff
changeset
|
65 $s->read(all => [{ type => 'PING' }]); |
fca71a8ebf6d
Tests: adjusted worker_shutdown_timeout_h2.t shutdown delay more.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1517
diff
changeset
|
66 |
1512
e84a3115bfe8
Tests: worker_shutdown_timeout_h2.t TODO adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1507
diff
changeset
|
67 $t->stop(); |
e84a3115bfe8
Tests: worker_shutdown_timeout_h2.t TODO adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1507
diff
changeset
|
68 |
1513
02412b209838
Tests: testing worker_shutdown_timeout works with HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1512
diff
changeset
|
69 like($t->read_file('access.log'), qr/ (?!504)\d{3} /, 'shutdown timeout'); |
02412b209838
Tests: testing worker_shutdown_timeout works with HTTP/2.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1512
diff
changeset
|
70 |
1507
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 sub http_silent_daemon { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 my $server = IO::Socket::INET->new( |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 Proto => 'tcp', |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 LocalAddr => '127.0.0.1:' . port(8081), |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 Listen => 5, |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 Reuse => 1 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 ) |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 or die "Can't create listening socket: $!\n"; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 while (my $client = $server->accept()) { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 $client->autoflush(1); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 while (<$client>) { } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 ############################################################################### |