clone 439470 -1 reassign -1 libhttp-server-simple-perl 0.27-1 retitle -1 libhttp-server-simple-perl: background() returns before the server is accepting requests severity -1 important tag 439470 patch forwarded 439470 http://rt.cpan.org/Public/Bug/Display.html?id=27168 forwarded -1 http://rt.cpan.org/Public/Bug/Display.html?id=28122 thanks
On Sat, Aug 25, 2007 at 10:28:00AM +0200, Lucas Nussbaum wrote: > Package: libtest-www-mechanize-perl > version: 1.14-1 > Severity: serious > User: [EMAIL PROTECTED] > Usertags: qa-ftbfs-20070823 qa-ftbfs > Justification: FTBFS on i386 > t/page_links_content.... > # Failed test 'Handles link content not found' > # in t/page_links_content.t at line 47. > # STDOUT is: > # ok 1 - Checking all page link content failures > # > # not: > # not ok 1 - Checking all page link content failures This is a non-deterministic timing problem. The HTTP::Server::Simple::background() function returns before it is ready to answer requests, and when the test script runs quick enough, it gets an unnoticed 'connection refused' from Test::WWW::Mechanize::get(). The script is then left with an empty array of links to test. This should be fixed in HTTP::Server::Simple; cloning accordingly. As a workaround for Test::WWW::Mechanize, either inserting a sleep call after the HTTP::Server::Simple::background() call or retrying a few times when the connection is refused should fix this. I'm attaching a patch for the sleep() option to keep the tests simple. It also adds an early test to verify that the server responded, for better diagnostics. The issues are already reported upstream as CPAN #27168 (Test::WWW::Mechanize) and CPAN #28122 (HTTP::Server::Simple). I'll follow up on those when I find the time. Cheers, -- Niko Tyni [EMAIL PROTECTED]
--- libtest-www-mechanize-perl-1.14.orig/t/link_content.t +++ libtest-www-mechanize-perl-1.14/t/link_content.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 9; +use Test::More tests => 10; use Test::Builder::Tester; use URI::file; @@ -24,8 +24,11 @@ my $mech=Test::WWW::Mechanize->new(); isa_ok($mech,'Test::WWW::Mechanize'); +# HTTP::Server::Simple->background() may return prematurely. +sleep 1; $mech->get('http://localhost:'.PORT.'/goodlinks.html'); my @urls=$mech->links(); +ok(@urls, 'Got links from the HTTP server'); # test regex test_out('not ok 1 - link_content_like');