Mercurial > hg > nginx-tests
comparison upgrade.t @ 1254:6fff42643fd7
Tests: binary upgrade.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 28 Nov 2017 15:26:08 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1253:86e6287707ee | 1254:6fff42643fd7 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # (C) Sergey Kandaurov | |
4 # (C) Nginx, Inc. | |
5 | |
6 # Tests for binary upgrade. | |
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 => 'can leave orphaned process group') | |
26 unless $ENV{TEST_NGINX_UNSAFE}; | |
27 | |
28 my $t = Test::Nginx->new()->plan(2)->write_file_expand('nginx.conf', <<'EOF'); | |
29 | |
30 %%TEST_GLOBALS%% | |
31 | |
32 events { | |
33 } | |
34 | |
35 EOF | |
36 | |
37 $t->run(); | |
38 | |
39 ############################################################################### | |
40 | |
41 my $pid = $t->read_file('nginx.pid'); | |
42 ok($pid, 'master pid'); | |
43 | |
44 kill 'USR2', $pid; | |
45 | |
46 for (1 .. 10) { | |
47 last if -e $t->testdir() . '/nginx.pid' | |
48 && -e $t->testdir() . '/nginx.pid.oldbin'; | |
49 select undef, undef, undef, 0.2 | |
50 } | |
51 | |
52 isnt($t->read_file('nginx.pid'), $pid, 'master pid changed'); | |
53 | |
54 kill 'QUIT', $pid; | |
55 | |
56 ############################################################################### |