changeset 34:e10649a96f39

Keepalive: use fastcgi_keep_conn in tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 03 Sep 2011 12:47:10 +0400
parents 52ca695446d3
children a84573f16a0c
files t/fastcgi-keepalive.t
diffstat 1 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/t/fastcgi-keepalive.t	Wed Aug 31 21:21:14 2011 +0400
+++ b/t/fastcgi-keepalive.t	Sat Sep 03 12:47:10 2011 +0400
@@ -17,8 +17,7 @@
 select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
-my $t = Test::Nginx->new()->plan(6)
-	->write_file_expand('nginx.conf', <<'EOF');
+my $t = Test::Nginx->new()->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -42,6 +41,7 @@
 
         location / {
             fastcgi_pass backend;
+            fastcgi_keep_conn on;
         }
     }
 }
@@ -49,36 +49,32 @@
 EOF
 
 $t->run_daemon(\&fastcgi_test_daemon);
-$t->run();
+
+eval {
+	open OLDERR, ">&", \*STDERR; close STDERR;
+	$t->run();
+	open STDERR, ">&", \*OLDERR;
+};
+plan(skip_all => 'no keepalive patches') if $@;
+
+$t->plan(6);
 
 ###############################################################################
 
-{
-local $TODO = 'needs experimental patches';
-local $SIG{__WARN__} = sub {};
-
 like(http_get('/'), qr/SEE-THIS/, 'fastcgi request');
 like(http_get('/redir'), qr/302/, 'fastcgi redirect');
 like(http_get('/'), qr/^request: 3$/m, 'fastcgi third request');
 
 like(http_get('/single'), qr/^connection: 1$/m, 'single connection used');
 
-}
-
 # New connection to fastcgi application should be established after HEAD
 # requests since nginx doesn't read whole response (as it doesn't need
 # body).
 
 unlike(http_head('/head'), qr/SEE-THIS/, 'no data in HEAD');
 
-{
-local $TODO = 'needs experimental patches';
-local $SIG{__WARN__} = sub {};
-
 like(http_get('/after'), qr/^connection: 2$/m, 'new connection after HEAD');
 
-}
-
 ###############################################################################
 
 # Simple FastCGI responder implementation.  Unlike FCGI and FCGI::Async it's