comparison worker_shutdown_timeout.t @ 1149:b1c2857d2e97

Tests: basic worker_shutdown_timeout test.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 09 Mar 2017 19:44:56 +0300
parents
children 06bb6af4324e
comparison
equal deleted inserted replaced
1148:44620036fedf 1149:b1c2857d2e97
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for worker_shutdown_timeout directive.
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
20 ###############################################################################
21
22 select STDERR; $| = 1;
23 select STDOUT; $| = 1;
24
25 plan(skip_all => 'win32') if $^O eq 'MSWin32';
26
27 my $t = Test::Nginx->new()->has(qw/http/)
28 ->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;
43 server_name localhost;
44
45 location / { }
46 }
47 }
48
49 EOF
50
51 $t->try_run('no worker_shutdown_timeout')->plan(1);
52
53 ###############################################################################
54
55 my $s = http('', start => 1);
56
57 kill 'HUP', $t->read_file('nginx.pid');
58 sleep 1;
59
60 is(http_get('/', socket => $s) || '', '', 'worker_shutdown_timeout');
61
62 ###############################################################################