Skip to content

Commit 3361c57

Browse files
committed
Tests: binary upgrade.
1 parent 8c15d8b commit 3361c57

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

upgrade.t

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
###############################################################################

0 commit comments

Comments
 (0)