Mercurial > hg > nginx-tests
changeset 251:df984d23f9d1
Tests: improve fastcgi keepalive tests.
On some platforms fastcgi_keepalive.t tests failed due to problems in
handling of data split into multiple packets. Harden tests to fail
on all platforms by adding more sleeps, and mark them as TODO till
underlying problems are fixed.
Additionally, add some padding testing.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 25 Jan 2013 20:53:53 +0400 |
parents | 0c9f15938545 |
children | 8b554d26eb1a |
files | fastcgi_keepalive.t |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/fastcgi_keepalive.t +++ b/fastcgi_keepalive.t @@ -68,16 +68,26 @@ like(http_get('/'), qr/SEE-THIS/, 'fastc like(http_get('/redir'), qr/302/, 'fastcgi redirect'); like(http_get('/'), qr/^request: 3$/m, 'fastcgi third request'); +TODO: { +local $TODO = 'not yet'; + 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'); +TODO: { +local $TODO = 'not yet'; + like(http_get('/after'), qr/^connection: 2$/m, 'new connection after HEAD'); +} + ############################################################################### # Simple FastCGI responder implementation. Unlike FCGI and FCGI::Async it's @@ -110,8 +120,11 @@ sub fastcgi_respond($$) { # stdout $h->{socket}->write(pack("CCnnCx", $h->{version}, 6, $h->{id}, - length($body), 0)); + length($body), 8)); $h->{socket}->write($body); + select(undef, undef, undef, 0.1); + $h->{socket}->write(pack("xxxxxxxx")); + select(undef, undef, undef, 0.1); # write some text to stdout and stderr splitted over multiple network # packets to test if we correctly set pipe length in various places @@ -124,7 +137,9 @@ sub fastcgi_respond($$) { $h->{socket}->write($tt . pack("CC", $h->{version}, 7)); select(undef, undef, undef, 0.1); $h->{socket}->write(pack("nnCx", $h->{id}, length($tt), 0)); + select(undef, undef, undef, 0.1); $h->{socket}->write($tt); + select(undef, undef, undef, 0.1); # close stdout $h->{socket}->write(pack("CCnnCx", $h->{version}, 6, $h->{id}, 0, 0)); @@ -133,6 +148,7 @@ sub fastcgi_respond($$) { # end request $h->{socket}->write(pack("CCnnCx", $h->{version}, 3, $h->{id}, 8, 0)); + select(undef, undef, undef, 0.1); $h->{socket}->write(pack("NCxxx", 0, 0)); }