evdb / HTTP-Async

process multiple HTTP requests in parallel without blocking
http://search.cpan.org/dist/HTTP-Async/lib/HTTP/Async.pm
8 stars 14 forks source link

very slow tests #10

Open mla opened 9 years ago

mla commented 9 years ago

Is there any way we can speed up the test suite?

When I need to install my app along with all dependencies, this module is esp. slow (2.75 minutes to run tests).

It's mainly caused by the t/bad-hosts.t test file. If I set the timeout() to 5 seconds there, the overall test runtime drops to ~ 40 seconds. Dunno if having a shorter timeout there is acceptable or not.

I'm on Linux Mint 17 with Perl 5.18.1

kaoru commented 9 years ago

Hi @mia

If you send me through your patch I'll probably apply it.

As you've probably seen I added the skip_all check for weird DNS issues:

# Some weird ISPs or DNS providers take an address like http://i.dont.exist/
# and resolve it to something "useful" such as
# http://navigationshilfe1.t-online.de/dnserror?url=http://i.dont.exist/
#
# If that's happening then let's just give up on this test entirely.
{
    my $ua = LWP::UserAgent->new;
    if ($ua->get('http://i.dont.exist/foo/bar')->is_success) {
        plan skip_all => 'http://i.dont.exist/foo/bar resolved to something!';
        exit;
    }
}

I've got two servers, one which triggers the problem and one which doesn't, but in both cases the test finishes very quickly.

alex@kyon:~/Documents/Git/HTTP-Async$ prove -lv t/bad-hosts.t
...
All tests successful.
Files=1, Tests=9,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.07 cusr  0.00 csys =  0.08 CPU)

alex@yuzu:~/Documents/Git/HTTP-Async$ prove -lv t/bad-hosts.t
...
skipped: http://i.dont.exist/foo/bar resolved to something!
...
Files=1, Tests=0,  0 wallclock secs ( 0.04 usr  0.00 sys +  0.14 cusr  0.01 csys =  0.19 CPU)

Maybe your DNS situation is even weirder than mine? :-)