Best practice for unit tests that rely on internet access?

Paul Makepeace paulm at paulm.com
Wed May 4 13:07:52 BST 2011


On Wed, May 4, 2011 at 12:24, David Cantrell <david at cantrell.org.uk> wrote:
> On Tue, May 03, 2011 at 10:39:17PM +0100, Alexander Clouter wrote:
>> David Cantrell <david at cantrell.org.uk> wrote:
>> > You could always check whether outbound HTTP is allowed by connecting to
>> > somewhere entirely different.  Try penthouse or thepiratebay -
>> > somewhere which is highly unlikely to have been explicitly whitelisted,
>> > so is a good test of whether Generic Web Stuff can be expected to work.
>> <network-monkey^Wsysadmin-hat> *winces* </network-monkey^Wsysadmin-hat>
>> I consider it 'unfriendly' to call on the resources of others for things
>> that do not benefit them and also if (for example)
>> penthouse/thepiratebay are down/unreachable (no such thing as "100%
>> Internet access")/depreated/expired/changed/filtered/etc then your,
>> possibly no longer actively maintained, module will fail.
>
> I would consider the impact of trying to grab penthouse's robots.txt,
> especially when it would only be accessed when testing a perl module, to
> be so minimal as to be of no consequence.  But feel free to grab
> http://cpxxxan.barnyard.co.uk/ instead if you'd prefer to hit a "willing
> victim"'s site.

How about the list of CPAN mirrors that the user has configured? I
don't know much about CPAN's internals but it doesn't seem a stretch
that that would be available or easily available through its API.

Even failing that, www.cpan.org seems wholly reasonable.

If you want a site that categorically will not notice, google.com and
kernel.org ...

Paul



More information about the london.pm mailing list