Mercurial > hg > nginx-tests
changeset 1254:6fff42643fd7
Tests: binary upgrade.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 28 Nov 2017 15:26:08 +0300 |
parents | 86e6287707ee |
children | b113eeca94ad |
files | upgrade.t |
diffstat | 1 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/upgrade.t Tue Nov 28 15:26:08 2017 +0300 @@ -0,0 +1,56 @@ +#!/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()->plan(2)->write_file_expand('nginx.conf', <<'EOF'); + +%%TEST_GLOBALS%% + +events { +} + +EOF + +$t->run(); + +############################################################################### + +my $pid = $t->read_file('nginx.pid'); +ok($pid, 'master pid'); + +kill 'USR2', $pid; + +for (1 .. 10) { + last if -e $t->testdir() . '/nginx.pid' + && -e $t->testdir() . '/nginx.pid.oldbin'; + select undef, undef, undef, 0.2 +} + +isnt($t->read_file('nginx.pid'), $pid, 'master pid changed'); + +kill 'QUIT', $pid; + +###############################################################################