Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 59788
Status: resolved
Priority: 0/
Queue: Test-WWW-Mechanize

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 1.30
Fixed in: (no value)

Attachments
0001-Fix-test-so-it-actually-checks-for-a-non-existent-do.patch



Subject: "Helpful" DNS servers break t/head_ok.t (with patch)
Download (untitled) / with headers
text/plain 621b
DNS servers that return their own advertising host for an unknown host break t/head_ok.t. I just discovered Qwest doing this to me. I see there is a check, but the check isn't working. I think the problem is that a full URL is being passed to gethostbyname(), it will always fail. It should be just the domain name. Also its an obviously invalid domain as it contains a trailing dot. Finally, the domain tested at the top isn't the domain tested at the bottom. I removed the unnecessary BEGIN blocks and constant, it made working with the code complicated. If necessary, I can turn DNS breaking back on to verify.
Subject: 0001-Fix-test-so-it-actually-checks-for-a-non-existent-do.patch
From 243346a68e46fea6d0507829343496588ca8f6cb Mon Sep 17 00:00:00 2001 From: Michael G. Schwern <schwern@pobox.com> Date: Wed, 28 Jul 2010 13:26:08 -0700 Subject: [PATCH] Fix test so it actually checks for a non-existent domain, not a URL. And use that verified not to exist domain. Remove complicating BEGIN blocks and constants. --- t/head_ok.t | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/t/head_ok.t b/t/head_ok.t index c123e70..69bf433 100644 --- a/t/head_ok.t +++ b/t/head_ok.t @@ -5,18 +5,13 @@ use warnings; use Test::More; use Test::Builder::Tester; -use constant NONEXISTENT => 'http://blahblablah.xx-nonexistent.'; -BEGIN { - if ( gethostbyname( NONEXISTENT ) ) { - plan skip_all => 'Found an A record for the non-existent domain'; - } -} +my $NONEXISTENT = 'blahblablah.xx-nonexistent.foo'; -BEGIN { - plan tests => 11; - use_ok( 'Test::WWW::Mechanize' ); -} +plan skip_all => "Found an A record for the non-existent domain $NONEXISTENT" + if gethostbyname $NONEXISTENT; +plan tests => 11; +require_ok( 'Test::WWW::Mechanize' ); use lib 't'; use TestServer; @@ -47,14 +42,14 @@ GOOD_HEAD: { # Stop giggling, you! } BAD_HEAD: { - my $badurl = 'http://wango.nonexistent.xx-only-testing/'; + my $badurl = 'http://$NONEXISTENT/'; $mech->head($badurl); - ok(!$mech->success, q{sanity check: we can't load NONEXISTENT.html} ); + ok(!$mech->success, q{sanity check: we can't load $badurl} ); test_out( 'not ok 1 - Try to HEAD bad URL' ); test_fail( +3 ); test_diag( '500' ); - test_diag( q{Can't connect to wango.nonexistent.xx-only-testing:80 (Bad hostname 'wango.nonexistent.xx-only-testing')} ); + test_diag( q{Can't connect to $NONEXISTENT:80 (Bad hostname '$NONEXISTENT')} ); my $ok = $mech->head_ok( $badurl, 'Try to HEAD bad URL' ); test_test( 'Fails to HEAD nonexistent URI and reports failure' ); -- 1.7.2
Download (untitled) / with headers
text/plain 136b
I'm going to apply this. Please note that the bug queue for Mech is at http://code.google.com/p/www-mechanize/issues/list, not here.
Download (untitled) / with headers
text/plain 130b
Your patch had probs with not interpolating $NONEXISTENT, but I have fixed it. Also, it only skips one block, not the whole test.
Subject: Re: [rt.cpan.org #59788] "Helpful" DNS servers break t/head_ok.t (with patch)
Date: Mon, 02 Aug 2010 14:20:59 -0700
To: bug-Test-WWW-Mechanize [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Download (untitled) / with headers
text/plain 474b
On 2010.8.2 1:53 PM, Andy Lester via RT wrote: Show quoted text
> I'm going to apply this. > > Please note that the bug queue for Mech is at > http://code.google.com/p/www-mechanize/issues/list, not here.
It seems that search.cpan.org is no longer honoring the bugtracker resource in META.yml. I'll poke them about it. -- If you want the truth to stand clear before you, never be for or against. The struggle between "for" and "against" is the mind's worst disease. -- Sent-ts'an


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.