# HG changeset patch # User Sergey Kandaurov # Date 1436440167 -10800 # Node ID 0940773278c7e2a3e75e2eb14f8acd83ee20d5c9 # Parent cb35a9ec44287b4346cdb0b09d14054ce273d09e Tests: backed out previous change, adjusted general timeouts. The previous timeout values are commonly not enough when making mass-building. diff --git a/lib/Test/Nginx.pm b/lib/Test/Nginx.pm --- a/lib/Test/Nginx.pm +++ b/lib/Test/Nginx.pm @@ -298,7 +298,7 @@ sub waitforfile($;$) { # wait for file to appear # or specified process to exit - for (1 .. 30) { + for (1 .. 50) { return 1 if -e $file; return 0 if $exited; $exited = waitpid($pid, WNOHANG) != 0 if $pid; @@ -313,7 +313,7 @@ sub waitforsocket($) { # wait for socket to accept connections - for (1 .. 30) { + for (1 .. 50) { my $s = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $peer @@ -541,7 +541,7 @@ sub http_start($;%) { eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(5); + alarm(8); $s = $extra{socket} || IO::Socket::INET->new( Proto => 'tcp', @@ -578,7 +578,7 @@ sub http_end($;%) { eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(5); + alarm(8); local $/; $reply = $s->getline(); diff --git a/proxy_limit_rate.t b/proxy_limit_rate.t --- a/proxy_limit_rate.t +++ b/proxy_limit_rate.t @@ -58,8 +58,7 @@ EOF ############################################################################### -my $s = http_get('/', start => 1); -my $r = http_end_gentle($s); +my $r = http_get('/'); my ($t1) = $r =~ /X-Msec: (\d+)/; my $diff = time() - $t1; @@ -70,29 +69,3 @@ cmp_ok(abs($diff - 3), '<=', 1, 'proxy_l like($r, qr/^(XXXXXXXXXX){4000}\x0d?\x0a?$/m, 'response body'); ############################################################################### - -sub http_end_gentle { - my ($s) = @_; - my $reply; - - eval { - local $SIG{ALRM} = sub { die "timeout\n" }; - local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(8); - - local $/; - $reply = $s->getline(); - - alarm(0); - }; - alarm(0); - if ($@) { - log_in("died: $@"); - return undef; - } - - log_in($reply); - return $reply; -} - -###############################################################################