Mercurial > hg > nginx-tests
comparison lib/Test/Nginx.pm @ 1206:c99c1f43cb15
Tests: reload() introduced in Test::Nginx.
This method replaces ad-hoc solutions to reload nginx, and adds win32 support.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Aug 2017 15:57:38 +0300 |
parents | c0fa3f818103 |
children | a6453cf5786a |
comparison
equal
deleted
inserted
replaced
1205:c0fa3f818103 | 1206:c99c1f43cb15 |
---|---|
419 } | 419 } |
420 | 420 |
421 return undef; | 421 return undef; |
422 } | 422 } |
423 | 423 |
424 sub reload() { | |
425 my ($self) = @_; | |
426 | |
427 return $self unless $self->{_started}; | |
428 | |
429 my $pid = $self->read_file('nginx.pid'); | |
430 | |
431 if ($^O eq 'MSWin32') { | |
432 my $testdir = $self->{_testdir}; | |
433 my @globals = $self->{_test_globals} ? | |
434 () : ('-g', "pid $testdir/nginx.pid; " | |
435 . "error_log $testdir/error.log debug;"); | |
436 system($NGINX, '-p', $testdir, '-c', "nginx.conf", | |
437 '-s', 'reload', @globals) == 0 | |
438 or die "system() failed: $?\n"; | |
439 | |
440 } else { | |
441 kill 'HUP', $pid; | |
442 } | |
443 | |
444 return $self; | |
445 } | |
446 | |
424 sub stop() { | 447 sub stop() { |
425 my ($self) = @_; | 448 my ($self) = @_; |
426 | 449 |
427 return $self unless $self->{_started}; | 450 return $self unless $self->{_started}; |
428 | 451 |