代码拉取完成,页面将自动刷新
#!/usr/bin/perl
# (C) Sergey Kandaurov
# (C) Nginx, Inc.
# Tests for binary upgrade.
###############################################################################
use warnings;
use strict;
use Test::More;
BEGIN { use FindBin; chdir($FindBin::Bin); }
use lib 'lib';
use Test::Nginx;
###############################################################################
select STDERR; $| = 1;
select STDOUT; $| = 1;
plan(skip_all => 'can leave orphaned process group')
unless $ENV{TEST_NGINX_UNSAFE};
my $t = Test::Nginx->new(qr/http unix/)->plan(4)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
events {
}
http {
%%TEST_GLOBALS_HTTP%%
server {
listen unix:%%TESTDIR%%/unix.sock;
server_name localhost;
}
}
EOF
my $d = $t->testdir();
$t->run();
###############################################################################
my $pid = $t->read_file('nginx.pid');
ok($pid, 'master pid');
kill 'USR2', $pid;
for (1 .. 30) {
last if -e "$d/nginx.pid" && -e "$d/nginx.pid.oldbin";
select undef, undef, undef, 0.2
}
isnt($t->read_file('nginx.pid'), $pid, 'master pid changed');
kill 'QUIT', $pid;
for (1 .. 30) {
last if ! -e "$d/nginx.pid.oldbin";
select undef, undef, undef, 0.2
}
ok(-e "$d/unix.sock", 'unix socket exists on old master shutdown');
# unix socket on new master termination
$pid = $t->read_file('nginx.pid');
kill 'USR2', $pid;
for (1 .. 30) {
last if -e "$d/nginx.pid" && -e "$d/nginx.pid.oldbin";
select undef, undef, undef, 0.2
}
kill 'TERM', $t->read_file('nginx.pid');
for (1 .. 30) {
last if ! -e "$d/nginx.pid.oldbin";
select undef, undef, undef, 0.2
}
ok(-e "$d/unix.sock", 'unix socket exists on new master termination');
###############################################################################
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。