# HG changeset patch # User Maxim Dounin # Date 1315039630 -14400 # Node ID e10649a96f39c1cdaabc43195a413f767defd9f7 # Parent 52ca695446d3ff9c063dd76608dc84eb67cc1941 Keepalive: use fastcgi_keep_conn in tests. diff --git a/t/fastcgi-keepalive.t b/t/fastcgi-keepalive.t --- a/t/fastcgi-keepalive.t +++ b/t/fastcgi-keepalive.t @@ -17,8 +17,7 @@ use Test::Nginx; 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 @@ http { location / { fastcgi_pass backend; + fastcgi_keep_conn on; } } } @@ -49,36 +49,32 @@ http { 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