t/81_hosts.t fails when OpenDNS is configured as DNS provider

Christian Walde walde.christian at gmail.com
Wed Oct 2 09:55:46 CEST 2013


On Tue, 01 Oct 2013 23:13:34 +0200, Marc Lehmann <schmorp at schmorp.de>  
wrote:

> On Tue, Oct 01, 2013 at 10:41:14PM +0200, Christian Walde  
> <walde.christian at gmail.com> wrote:
>> Test fails are meant to indicate a failure with the distribution itself,
>> not incompatibilities with a broken environment. As such the current  
>> test FAIL is a mis-signal, since there is no actual fault in the AE  
>> code.
>
> That doesn't make any sense - according to your logic, the tests should
> also succeed if the computer has bad ram, or perl has a bug that randomly
> corrupts memory.
>
> While it is not the job of tests to signal problems outside of it, it's
> also not the job of the tests to work around broken configurations and
> pretend everything is fine when it isn't.

You're right, not all system breakages can be or can be expected to be
detected and worked around by tests. I was describing the intent of the
cpantesters infrastructure and why i believe that your specific test is an
ideal case that can do this.

>> Since this kind of breakage is easily detected
>
> How would you dteect the breakage? All your proposed is hardcoding  
> OpenDNS servers somehow. That doesn't detect any breakage.

My first thoughts on this were naive, but in the meantime i've picked up
better ideas on the matter. A very simple way of testing for a DNS service
that returns bogus results instead of failing properly would simply be  
this:

     SKIP: {
         $ENV{PERL_ANYEVENT_HOSTS} = File::Spec->devnull;

         skip "DNS returns bogus results", 2 if resolved $test_host;

         $ENV{PERL_ANYEVENT_HOSTS} = $hosts_file;

         is resolved $test_host, $test_addr, 'resolved on first attempt';
         is resolved $test_host, $test_addr, 'resolved on second attempt';
     };

-- 
With regards,
Christian Walde



More information about the anyevent mailing list