Mercurial > hg > nginx-tests
annotate worker_shutdown_timeout_h2.t @ 1507:8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 09 Sep 2019 17:51:47 +0300 |
parents | |
children | e84a3115bfe8 |
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 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(1); |
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 { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 listen 127.0.0.1:8080 http2; |
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 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 location / { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 proxy_pass http://127.0.0.1:8081; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 proxy_read_timeout 200ms; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 } |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 } |
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 EOF |
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 $t->run_daemon(\&http_silent_daemon); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 $t->run()->waitforsocket('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
|
55 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 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
|
59 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
|
60 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 select undef, undef, undef, 0.1; |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 $t->stop()->todo_alerts(); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 ############################################################################### |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 sub http_silent_daemon { |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 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
|
68 Proto => 'tcp', |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 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
|
70 Listen => 5, |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 Reuse => 1 |
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 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
|
74 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 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
|
76 $client->autoflush(1); |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
8958b5b53c25
Tests: HTTP/2 tests for alerts seen with worker_shutdown_timeout.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 while (<$client>) { } |
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 } |
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 ############################################################################### |