Mercurial > hg > nginx-tests
comparison 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 |
comparison
equal
deleted
inserted
replaced
1506:c4c2275cda55 | 1507:8958b5b53c25 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for worker_shutdown_timeout and HTTP/2 with proxy. | |
7 | |
8 ############################################################################### | |
9 | |
10 use warnings; | |
11 use strict; | |
12 | |
13 use Test::More; | |
14 | |
15 BEGIN { use FindBin; chdir($FindBin::Bin); } | |
16 | |
17 use lib 'lib'; | |
18 use Test::Nginx; | |
19 use Test::Nginx::HTTP2; | |
20 | |
21 ############################################################################### | |
22 | |
23 select STDERR; $| = 1; | |
24 select STDOUT; $| = 1; | |
25 | |
26 my $t = Test::Nginx->new()->has(qw/http http_v2 proxy/)->plan(1); | |
27 | |
28 $t->write_file_expand('nginx.conf', <<'EOF'); | |
29 | |
30 %%TEST_GLOBALS%% | |
31 | |
32 daemon off; | |
33 worker_shutdown_timeout 10ms; | |
34 | |
35 events { | |
36 } | |
37 | |
38 http { | |
39 %%TEST_GLOBALS_HTTP%% | |
40 | |
41 server { | |
42 listen 127.0.0.1:8080 http2; | |
43 server_name localhost; | |
44 | |
45 location / { | |
46 proxy_pass http://127.0.0.1:8081; | |
47 proxy_read_timeout 200ms; | |
48 } | |
49 } | |
50 } | |
51 EOF | |
52 | |
53 $t->run_daemon(\&http_silent_daemon); | |
54 $t->run()->waitforsocket('127.0.0.1:' . port(8081)); | |
55 | |
56 ############################################################################### | |
57 | |
58 my $s = Test::Nginx::HTTP2->new(); | |
59 ok($s->new_stream(), 'new stream'); | |
60 | |
61 select undef, undef, undef, 0.1; | |
62 $t->stop()->todo_alerts(); | |
63 | |
64 ############################################################################### | |
65 | |
66 sub http_silent_daemon { | |
67 my $server = IO::Socket::INET->new( | |
68 Proto => 'tcp', | |
69 LocalAddr => '127.0.0.1:' . port(8081), | |
70 Listen => 5, | |
71 Reuse => 1 | |
72 ) | |
73 or die "Can't create listening socket: $!\n"; | |
74 | |
75 while (my $client = $server->accept()) { | |
76 $client->autoflush(1); | |
77 | |
78 while (<$client>) { } | |
79 } | |
80 } | |
81 | |
82 ############################################################################### |