Tests: tweak various timeouts and replace sleep() with select(). Hopefully this will result in less spurious test failures, in particular on our Solaris VM.
diff --git a/proxy_cache.t b/proxy_cache.t index 147e1f1..4539b09 100644 --- a/proxy_cache.t +++ b/proxy_cache.t
@@ -101,7 +101,7 @@ like(http_get('/empty.html'), qr/HTTP/, 'empty get first'); like(http_get('/empty.html'), qr/HTTP/, 'empty get second'); -sleep(2); +select(undef, undef, undef, 1.1); unlink $t->testdir() . '/t.html'; like(http_gzip_request('/t.html'), qr/HTTP.*1c\x0d\x0a.{28}\x0d\x0a0\x0d\x0a\x0d\x0a\z/s,
diff --git a/proxy_cache_lock.t b/proxy_cache_lock.t index f5c19e3..ffc1679 100644 --- a/proxy_cache_lock.t +++ b/proxy_cache_lock.t
@@ -56,7 +56,7 @@ proxy_cache NAME; proxy_cache_lock on; - proxy_cache_lock_timeout 300ms; + proxy_cache_lock_timeout 200ms; } location /nolock { @@ -137,7 +137,7 @@ eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(2); + alarm(3); $s = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1:8080' @@ -161,7 +161,7 @@ eval { local $SIG{ALRM} = sub { die "timeout\n" }; local $SIG{PIPE} = sub { die "sigpipe\n" }; - alarm(2); + alarm(3); local $/; $reply = $s->getline(); log_in($reply); @@ -204,7 +204,7 @@ next unless $uri; - sleep(1); + select(undef, undef, undef, 0.5); $num++; print $client <<"EOF";
diff --git a/proxy_store.t b/proxy_store.t index c6412f0..97b52ed 100644 --- a/proxy_store.t +++ b/proxy_store.t
@@ -83,13 +83,13 @@ ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files'); http_get('/store-index-big.html', aborted => 1, sleep => 0.1); -sleep(1); +select(undef, undef, undef, 0.5); ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files after aborted request'); http_get('/ssi.html', aborted => 1, sleep => 0.1); -sleep(1); +select(undef, undef, undef, 0.5); ok(scalar @{[ glob $t->testdir() . '/proxy_temp/*' ]} == 0, 'no temp files after aborted ssi');