Subject: | Test failures if example.com cannot be reached |
The test suite fails on all my freebsd smokers, see
http://matrix.cpantesters.org/?dist=LWP-UserAgent-Mockable%201.13
First reason is that t/10-basic-record.t is skipped because of
use Test::RequiresInternet ('www.example.com' => 80);
The smoker machines have internet access, but: the freebsd name server is resolving www.example.com to 127.0.0.1, and there's no web server running on localhost, so Test::RequiresInternet thinks that there's no internet connection. See also
https://github.com/freebsd/freebsd-ports/blob/master/dns/bind99/files/named.conf.in#L240
https://github.com/freebsd/freebsd-ports/blob/master/dns/bind99/files/empty.db
for the default name server configuration.
10-basic-record.t has the side-effect of creating basic.mockdata which is used in later tests, which are consequently failing:
Can't open basic.mockdata: Datei oder Verzeichnis nicht gefunden at /usr/home/eserte/.cpan/build/2015092218/LWP-UserAgent-Mockable-1.13-owid4Z/blib/lib/LWP/UserAgent/Mockable.pm line 73.
Compilation failed in require at t/11-basic-playback.t line 14.
BEGIN failed--compilation aborted at t/11-basic-playback.t line 14.
t/11-basic-playback.t ......................
Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
I also can imagine that on other systems with different nameserver configuration the test may fail if the test suite is run in parallel --- in this case the order of executed test files is random.
My proposals are:
- Use another address for Test::RequiresInternet. Probably it's best to use www.google.com:80, as you're fetching from google anyway.
- Skip the 11-basic-playback.t test if basic.mockdata is missing (which can happen in an environment without network, or with shuffled/parallel testing)