changeset 233:1a5574d84917

Tests: tweak various timeouts and replace sleep() with select(). Hopefully this will result in less spurious test failures, in particular on our Solaris VM.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 10 Sep 2012 20:18:05 +0400
parents 4c43b3a0117c
children 62114a0c1389
files proxy_cache.t proxy_cache_lock.t proxy_store.t
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/proxy_cache.t
+++ b/proxy_cache.t
@@ -101,7 +101,7 @@ like(http_get_range('/t.html', 'Range: b
 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,
--- a/proxy_cache_lock.t
+++ b/proxy_cache_lock.t
@@ -56,7 +56,7 @@ http {
             proxy_cache   NAME;
 
             proxy_cache_lock on;
-            proxy_cache_lock_timeout 300ms;
+            proxy_cache_lock_timeout 200ms;
         }
 
         location /nolock {
@@ -137,7 +137,7 @@ sub http_start {
 	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 @@ sub http_end {
 	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 @@ sub http_fake_daemon {
 
 		next unless $uri;
 
-		sleep(1);
+		select(undef, undef, undef, 0.5);
 
 		$num++;
 		print $client <<"EOF";
--- a/proxy_store.t
+++ b/proxy_store.t
@@ -83,13 +83,13 @@ ok(!-e $t->testdir() . '/store-index-nos
 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');